如何在只知道扩展名的情况下删除.part1.rar,part01.rar等



这段代码应该删除成功提取的存档,其中第一个是已知的%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"

我明白了

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")

最新更新