11

I have a folder containing subfolders named A, B, C, and some files like file1.doc, file2.bat, file3.doc.

Is there any option of the WinRAR software so that, when I zip the folder, I can tell it to exclude folder A, .bat, files and files whose name is file3.doc?

2 Answers 2

16

You can automate compressing files with WinRAR and provide an exclusion list using a command line interface. You can exclude the files and folders using -x switch in the command.

Run Command Prompt (cmd.exe) and type the following command:

"C:\Program Files\WinRAR\Rar.exe" a -x*\A -x*.bat -xfile3.doc folder.rar folder

If you want to automate your GUI, you can add this command to a context menu when you right-click on a folder. You would need to add the following to the registry:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\rar_with_exclusion]
@="WinRAR with exclusion list"

[HKEY_CLASSES_ROOT\Directory\shell\rar_with_exclusion\command]
@="\"C:\\Program Files\\WinRAR\\Rar.exe\" a -x*\\a -xfile3.doc -x*.bat \"%1.rar\" \"%1\""

Refer to this document to learn how to modify the registry.

This is what you will get in the end:

enter image description here

1
  • This seems promising, but is not clear. I guess -x*.bat and -xfile3.doc are examples of files or filetypes to be excluded? So then the registry edit is specific to this single WinRAR task? Or does file3.doc contain the exclusion list? Does it have to be a .doc file? etc. Jun 6, 2022 at 5:01
0

Go inside a Folder And select all press CNTRL and deselect the folder you don`t want to compress / zip and Right click in options you can now Compress excluding the folder and files

1
  • That does not answer the question because the question was how to compress a folder containing the files and folders that have to be excluded. By extracting the archive using Extract here there should be a folder created that contains archived files and folders.
    – Chupo_cro
    Sep 25 at 11:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .