0

I have an existing archive.7z, which contains some .txt, .bin and .log files.
I would like to delete all files with extension different from .txt using 7zip command line from Windows cmd.

I try this command but doesn't work:

7z -t7z d -r "D:\Data\archive.7z" !*.txt

how to delete all not .txt files without extract and compress again the archive?
Thanks

0

Use -x switch.

-x (Exclude filenames) switch Specifies which filenames or wildcarded names must be excluded from the operation.

  • It works. The command I used is: 7z -t7z d -r "D:\Data\archive.7z" -x!^*.txt – Cyr Jan 10 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.