我有一个运行 7zip 的批处理脚本,它允许我将所有文件压缩到一个文件夹中。我只想压缩修改日期为 2010 年或我选择的其他日期的文件。我想在将文件归档到 zip 文件夹后删除这些文件。这是我的逻辑。查找 2012 年的文件并将这些文件存档到名为 2012 的文件夹中。压缩文件夹并删除文件。0
这就是我到目前为止所拥有的。
@ECHO OFF
REM This sets name of the zip file
Set choice=
set /p choice=What is the year of the files?
PAUSE
REM This sets the path of the file
Set path=
set /p path=What is the path of the files on C:\'path'\?
REM Use 7Zip to Zip files in folder c:\path and place the zip archive in C:\path
ECHO.
ECHO Zipping all files in C:\%path% and moving archive to c:\%path%
ECHO.
PAUSE
C:\7z a -tzip "C:\%path%\%choice%.zip" "C:\%path%\*.*" -mx5
ECHO.
PAUSE
ECHO Would you like to Delete the files in orginal folder?
DEL "C:\%path%\*.*"
PAUSE
ECHO File is now zipped