我有一个批处理脚本,做以下批处理脚本移动压缩和删除文件
@ECHO OFF
REM move files older than 2 days from the incoming directory to the incoming archive directory
robocopy D:\Agentrics\integration\download D:\Agentrics\integration\download\archive /MOV /MINAGE:2
REM Zip files in the Archieve directory that are older than one week
FOR %%A IN (D:\Agentrics\integration\download\archive\*.txt*, D:\Agentrics\integration\download\archive\*.cpi*) DO "C:\Program Files\WinRAR\WinRAR.exe" a -r -to7d D:\Agentrics\integration\download\archive\"%%~nA.zip" "%%A"
REM Delete Original files after they are zipped
forfiles /p D:\Agentrics\integration\download\archive /s /m *.txt* /d -7 /c "cmd /c del /q @path"
forfiles /p D:\Agentrics\integration\download\archive /s /m *.cpi* /d -7 /c "cmd /c del /q @path"
REM Delete files that are older than 6 months from the archive directory
forfiles /p D:\Agentrics\integration\download\archive /s /m *.zip* /d -180 /c "cmd /c del /q @path"
pause
问题1: 当我运行该脚本,我得到了一些文件,WinRAR的诊断信息。例如,如果传入目录中的文件不超过两天,我会收到此消息。“WinRAR诊断消息:无文件添加”。由于这个消息,脚本停止,直到我点击对话框的关闭按钮。我正在使用免费版本的WinRAR并且它没有过期
问题2:我在上面的脚本中有两个seprate命令。一个是压缩一周以上的文件,另一个是压缩后删除原始文件。我如何链接这两个命令,以便如果文件没有被压缩的原因,他们也不应该被删除。或者,如果文件没有被压缩,是否有命令来中断脚本?我只是想先旗牌文件,然后删除原有的