这部分代码应该删除成功提取的存档,其中第一个是已知的%fullpath%\%file%.%exe%
。它使用???
通配符,因此它会删除.7z.001
,.zip.001
和.r01
之类的多部分,但不能删除.part1.rar, .part01.rar, .part001.rar
之类的多部分。
echo successfully unpacked "%fullpath%\%file%.%ext%"
attrib -r "%fullpath%\%file%.???"
for /r "%fullpath%" %%r in (%file%.???) do del "%%r" && echo deleted "%%r"
答案 0 :(得分:0)
我明白了
echo unpacked "%fullpath%\%file%.%ext%"
attrib -r "%fullpath%\*.*" /s
:: maybe a little more concern here? also deletes every other filetype with the same name
for /r "%fullpath%" %%r in (%file%.??? %file:~0,-6%.part?.rar %file:~0,-7%.part??.rar %file:~0,-8%.part???.rar) do (
if exist "%%r" del "%%r" >nul 2>nul && echo deleted extracted archive "%%r")