简体   繁体   中英

A batch file to download and delete files from a server

How can I write a MS dos ftp batch file to:

  1. download files from the server to my local pc
  2. 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

passwordhere

cd /httpdocs/store/files

need get, list and delete commands here??

quit

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!

ftp.exe程序可以将某种脚本文件作为输入 (该示例上载了文件,但是我想知道了),因此您应该能够为需要执行的命令创建脚本,然后使用适当的输入创建一个批处理文件,启动ftp.exe。

you can download ncftpput/ncftpget . With ncftpget , there's option to remove remote files after downloading.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM