문제

I have a thousand zip archives that all contain a file I want to remove. I can get 7Zip to remove them one file at a time from the command line:

7z d -r archive.zip *.pdf

but how would I apply that across all the files, which are themselves grouped in sub-directories?

도움이 되었습니까?

해결책

Try this:

for /r %v in (*.zip) do 7z d -r "%v" *.pdf

But no idea if it's working, just wrote out of my head :P

다른 팁

FOR /F "tokens=*" %%G IN ('dir /b *.zip') DO 7z.exe d -r %%G *.pdf

This works almost in the same way as the accepted answer. Only the way how the files are gathered is different. Whereas the answer above uses for /r to run through all directories and subdirectories, this one parses the output of the command dir /b *.zip to get all the files relevant.
The 7zip command remains the same and only the parameters are changed.

Note: To run this outside of a batchfile replace %%G with %G

Sometimes simple things can solve the problems...

do the following to delete any file / all file from selected .zip files>

  1. Move the .zip files to a new folder
  2. Select all the files from which files to be deleted
  3. right click and select option "extract each archive to separate folder"
  4. all the zip files shall be converted to folder now.
  5. use and file search tool like SearchMyFiles and find required files, select and delete.
  6. convert the folders back to .zip
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top