How to delete a file from multiple zip archives using 7-Zip

岁酱吖の 提交于 2019-12-23 19:18:01

问题


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?


回答1:


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




回答2:


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




回答3:


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


来源:https://stackoverflow.com/questions/22344587/how-to-delete-a-file-from-multiple-zip-archives-using-7-zip

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!