[英]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. 我正在尝试创建一个.bat文件来删除某个ftp文件夹中的所有xml文件,而不管文件的日期。 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. 许多专家都在讨论包含以下脚本的.txt文件,但说实话,我不知道如何执行它,甚至是我是否正确创建文件。
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. 您的FTP脚本看起来不错。 You just might want to replace
mdelete *
with mdelete *.xml
, if there are also other files than .xml
in the folder. 如果文件夹中还有除
.xml
之外的其他文件,您可能只想用mdelete *.xml
替换mdelete *
。
To actually run the script, run ftp.exe
from your batch file like: 要实际运行该脚本,请从批处理文件中运行
ftp.exe
,如:
@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). 其中
ftp.txt
是包含FTP脚本的文件名(问题中的那个)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.