7zip command line - extract all files in a folder except *.exe

I am using the command:

7z.exe x -y -o<dir> <archive dir> * -aoa -r

to extract all archives that are located in the archive directory.

I am running into a problem where exe files that are packaged end up getting extracted as well.

Is there a way to extract all files within a directory but exclude *.exe files?

I tried the -x flag (-x!.exe and -xr!.exe), but they exclude extracting *.exe from within the rar and zip archives.

Thanks for the help.

1 Answer

You should specify what files to extract from inside the <archive> folder. If you want to only extract files from .zip files, you should specify <archive>\*.zip.

7z.exe x -y -o<dir> <archive dir>\*.zip * -aoa -r
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like