Skip to content

Instantly share code, notes, and snippets.

@chrislkeller chrislkeller/README.md
Last active Oct 5, 2015

Embed
What would you like to do?
Loop to download a file from FTP, create a symlink to the file and append date and time to subsequent downloads...

Bash script to download file from FTP

Loop to download a file from FTP, create a symlink to the file and append date and time to subsequent downloads...

#!/bin/bash
# open loop
while true
# open the loop action
do
# sets date to date
DATE=`date +%Y%m%d%H%M%S`
# hits ftp and downloads
curl -o $DATE-<FILE NAME HERE> ftp://<USERNAME HERE>:<PASSWORD HERE>@<FTP PATH HERE>
# remove the file
rm <FILE NAME HERE>
# hits ftp and downloads
ln -s $DATE-<FILE NAME HERE> <FILE NAME HERE>
# rests for a minute
sleep 120
# close the loop action
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.