A batch file to download and delete files from a server
How can I write a MS dos ftp batch file to:
- download files from the server to my local pc
- remove these files from the server after download
Edit:
So far I have...
Batch file:
ftp.exe -s:ftp.txt
FTP.txt:
open domain.com
usernamehere
passw开发者_如何学运维ordhere
cd /httpdocs/store/files
need get, list and delete commands here??
quit
The ftp.exe program can take a sort of script file as input (that example uploads a file, but I guess to get the idea), so you should probably be able to create a script for the commands that you need to carry out, and then have a batch file launch ftp.exe with the appropriate input.
From one of my cuestions in other post.
user-name
user-password
lcd c:\localfolder-where-download
cd remote-folder
mget .
mdelete \\remote-folder\ .
quit
1 & 2 line , your credentials 3 - line local folder where the ftp can download the content 4- line - remote folder if needed 5- line - get al content to your local folder 6- line - delete all content from your remote folder 7- line quit!
you can download ncftpput/ncftpget. With ncftpget
, there's option to remove remote files after downloading.
精彩评论