2
votes

I am trying to set up an automatic download of the files from a FTP directory on a scheduled basis. The solution I have come up with is to create a batch file that will be ran by windows task scheduler. The batch file is as follows (so far)

prompt
open ftp://xx.xx.xx.xx
myuser
mypassword
lcd C:\localdir
cd /remotedir/
mget *
quit

The problem is that this does not get everything in the specified directory. Only the loose files in the directory such as a .zip or .txt file. I have searched the questions here to no avail. So how can I get mget to not only download loose files in the root directory but also download the sub-directories and containing files (keeping the structure intact)?

1
You can not easily do that. You should probably take a look at the 'rsync' command.perh
FTP.EXE in Windows doesn't have support for downloading folder trees.foxidrive
If this can not easily be done via the FTP.exe can anyone suggest an alternative. I am looking for a way to do this that will be very transparent to the end user. So if possible no GUI will load and they won't even know it is happening. This is for file roll out for my company.user3538260
Can you zip up the folder tree on the FTP server, ftp that file and then unzip it? The file itself can be a self extracting zip file. Add @foxidrive to your comment if you want me to see it.foxidrive

1 Answers

2
votes

Just answering this in case anyone else has a similar issue. The ftp.exe was a bust but I found out it is fairly easy using WinSCP just create a scheduled task in task scheduler and use the options section for command line parameters

Instructions for creating download script with WinSCP:
http://winscp.net/eng/docs/guide_automation

Instructions for scheduling WinSCP transfer task:
http://winscp.net/eng/docs/guide_schedule

WinSCP downloads directories recursively by default.