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

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

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest