25
3
I would like to FTP the contents of a directory, but I can't seem to find the right way to use a wildcard. It seems like this would be a common thing to do; is my whole approach wrong?
The command is
ftp -s:"C:\Scripts\ftp01" ftpserver.domain.com
The script that is called is below. Updated per billinkc.
username
password
ascii
cd "/destinationfolder"
lcd "C:\Backup"
mput *.bak
close
quit
The script starts, no files are copied and the FTP session remains open.
230 User username Logged in Successfully
ftp> ascii
200 TYPE Command OK A
ftp> cd "/destinationfolder"
250 Directory successfully changed to "/destinationfolder"
ftp> lcd "C:\Backup"
Local directory now C:\Backup.
ftp> mput *.bak
mput 9829980.bak? close
mput 6406766.bak? quit
ftp>
ftp>
Conclusion
I needed to add the flag to suppress the PROMPT command:
ftp -i -s:"C:\Scripts\ftp01" ftpserver.domain.com
3For those wondering "what is the syntax of this
prompt
command", you literally just type "prompt" and it toggles prompting from true to false. – Noumenon – 2017-01-08T12:24:39.3402
Another way of disabling interactive prompting is to use the
– Jesse Webb – 2017-08-11T20:11:34.233-i
flag on theftp
command itself (e.g.ftp -i -s:"C:\Scripts\ftp01" ftpserver.domain.com
). The docs describe the-i
option as: "Turns off interactive prompting during multiple file transfers."