LewisMCT333
LewisMCT333

Reputation: 105

Serverside FTP Batch script

Ive been using a .bat script to download only pdfs from an FTP server.

Up until now its been working perfectly using the mget *pdf function.

I recently moved the script and have it running from a Windows 2012 Server.

And now when script gets to the mget function, it lists the files that would normally transfer except with a ? after each instance, it then fails to actually download them to the lcd.

@ftp -v -n -i -s:C:\Users\LMCT\Desktop\Serversidesage\download-1.txt

This is the FTP function being called.

open xx.xxx.xx.xxx
user xxxxxxxxxxx
=xxxxxxxxxxxx
cd orders
lcd "C:\Users\LMCT\Desktop\Magento-downloaded-orders"
binary
prompt
mget *pdf
mdelete *pdf
quit

And this is the downloading script.

Does anyone know why this might be happening?

Thanks in advance.

Kind Regards, Lewis.

Upvotes: 1

Views: 264

Answers (1)

Squashman
Squashman

Reputation: 14290

By Default Interactive Prompting is ON. When you used the -I option to launch the FTP command it is turning Prompting off. In your script you are then turning it back on with the PROMPT command which then throws off your MGET command.

So if the PROMPT command is in your FTP script:

open ftp.domain.com
user ftpuser
password
prompt
quit

It is easy test to see what is going on.

C:\BatchFiles\ftp>ftp -v -i -n -s:"script.txt" |find "Interactive"
Interactive mode On .

C:\BatchFiles\ftp>ftp -v -n -s:"script.txt" |find "Interactive"
Interactive mode Off .

Upvotes: 2

Related Questions