Loop to download a file from FTP, create a symlink to the file and append date and time to subsequent downloads...
Last active
October 5, 2015 23:17
-
-
Save chrislkeller/2893801 to your computer and use it in GitHub Desktop.
Loop to download a file from FTP, create a symlink to the file and append date and time to subsequent downloads...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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