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...
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 |