我需要一个批处理脚本,将文件从FTP文件夹复制到另一个文件夹。它应该在之后备份FTP上的文件夹并删除原件。
我已经走到了这一步。它现在只将文件复制到文件夹。如何备份FTP上的文件夹并在之后将其删除?
谢谢
@Echo Off
Set _FTPServerName=
Set _UserName=
Set _Password=
Set _LocalFolder=C:\Users\%username%\Desktop\
Set _RemoteFolder=Public\Testfolder\
Set _Filename=file.txt
Set _ScriptFile=ftp1
Set _BackupFolder=Public\Backup
:: Create script
>"%_ScriptFile%" Echo open %_FTPServerName%
>>"%_ScriptFile%" Echo %_UserName%
>>"%_ScriptFile%" Echo %_Password%
>>"%_ScriptFile%" Echo lcd %_LocalFolder%
>>"%_ScriptFile%" Echo cd %_RemoteFolder%
>>"%_ScriptFile%" Echo binary
>>"%_ScriptFile%" Echo get %_Filename%
>>"%_ScriptFile%" Echo quit
:: Run script
ftp -s:"%_ScriptFile%"
Del "%_ScriptFile%"
使用mget
command:
>>"%_ScriptFile%" Echo mget *