Ubuntu – FTP script download from linux to windows

ftpUbuntuwindows-xp

I'm using following FTP script on windows xp to download zip files from ubuntu cloud servers. A zip file is created every day on ubutnu servers and I will download it to windows via this ftp script.
I run this script everyday manually as I have to edit the last line(mget /usr/backup_02-11-2010.Zip) of the script to match today's date. I want to edit this script so that it will download only today's zip file at the scheduled time without needing to edit it everyday, when scheduled. It's clear that date is appended to the zip files and is in the format dd-mm-yyyy. Need help…

open server-ip-here
username-here
user-password-here
lcd C:\Backup\files
bin
hash
prompt  
mget /usr/backup_02-11-2010.zip

Best Answer

Add a variable containing your desired date format to your script:

set mydate=%date:~0,2%-%date:~3,2%-%date:~6,4%

This will echo the current date in format dd-mm-yyyy. Then you can use the variable mydate to get the actual file:

get /usr/backup_%mydate%.Zip