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
Best Answer
Before issuing the
mput
command, issue aprompt
command to disable Interactive Mode. Once that's off it shouldn't ask you to confirm each file for themput
(or anmget
).