Search code examples
ftpbatch-filedosftp-client

FTP Batch Scripts in Windows not working


I try to download a set of files from an FTP. I use the following command for that.

ftp  -v -s:DownloadCommand.txt ftp.SampleFTP.com>>%log%

This particular code works when executed in the development machine, but when executed in production, it does't work. I have nothing logged into my log file. No error is getting thrown.

Can someone help.? Thanks.

Additional Info. the Downloadcommand.txt has the following

<username>
<password>
binary
cd <FolderName>
lcd <LocalPath>
prompt
mget <FileName>
quit

Solution

  • The problem was DownloadCommand.txt was not accessible by the .bat file, though they were on the same folder. I solved the problem, by using PUSHD "path of the DownloadCommand.txt" before calling the FTP.