简体   繁体   中英

How to run FTP script from batch file on Windows?

I'm trying to create a .bat file to delete all xml files on a certain ftp folder regardless of the date of the file. I've tried many scripts without any solution.

Many experts are talking about .txt file containing the below script, but to be quite honest I don't know how to execute it or even am if I am creating the file correctly or not.

All I need is to delete all the files on this container.

open ftp://xxxx.xxxx.net
myusername
mypassword
cd /bts/xxxx
mdelete *
quit

Your FTP script looks ok. You just might want to replace mdelete * with mdelete *.xml , if there are also other files than .xml in the folder.

To actually run the script, run ftp.exe from your batch file like:

@echo off
echo Running FTP to delete XML files...
ftp -s:ftp.txt

where ftp.txt is filename containing your FTP script (the one from your question).

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