Setting WinRAR to exclude files with the exact filename I specify from being extracted from an archive

2

0

How can I configure WinRAR to exclude files with the exact filenames: thumbs.db or .DS_Store (ignoring case) from being extracted from an archive (all directory levels within an archive)?

Files with these filenames should not be extracted:

Thumbs.db
thumbs.db
THUMBS.DB
.DS_Store 
.ds_store
.DS_STORE

Files with these names should be extracted:

1Thumbs.db
1thumbs.db
tackthumbs.db
Thumbs.db.txt
Abcd thumbs.db.txt
1.DS_Store
Abcd.ds_store
.DS_Store.txt
Abcd.DS_STORE.txt

Also, does anyone know if WinRAR has a syntax guide for the prohibited file types list in case I'd like to add more filenames or be flexible with the rules I need?

Essentially I'd like to avoid extracting unnecessary files from ZIP, RAR or 7z archives in Windows 7 - files like Windows 2000/XP's Thumbs.db file (Thumbnail cache) and Mac OS X' .DS_Store file (Desktop Services Store), while not being too strict and also not extracting files which just contain 'Thumbs.db' or '.DS_Store' in its filename.

Edit: I've entered thumbs.db .DS_Store in the WinRAR prohibited file list. I have encountered a ZIP file that has a .DS_Store file in a 2nd level directory. (Zipfile.zip > Parent Directory > Directory where .DS_Store is stored). When I extract this ZIP file, WinRAR still extracts the .DS_Store file. Changing .DS_Store to *.DS_Store in the prohibited files list fixes this. The same issue happens with thumbs.db files.

My prohibited files list is now *thumbs.db *.DS_Store, while this could exclude *thumbs.db and *.DS_Store in all directories, my concern is that this could also affect filenames that I do not intend to exclude (e.g. SampleThumbs.db or Sample.DS_Store).

Anyone know why the previous entry didn't work in non-root directories in this case? Also, is there a better entry in the Prohibited files list that will work to exclude only thumbs.db and .DS_Store files for all directory levels in a ZIP/RAR/7z file?

galacticninja

Posted 2011-04-22T14:58:50.780

Reputation: 5 348

Answers

2

Yes, it will work exactly like that. I created a test folder containing the following files:

  • DONOTHING.txt
  • THUMBS.db
  • .DS_STORE
  • 1Thumbs.db
  • Thumbs.db.txt

I then added these to a new RAR archive and configured the Prohibited file types dialogue as per the following screenshot:

Prohibited file types

The defaults were a set of wildcarded file extensions so I didn't think having full filenames would work, but tried anyway. I opened the previously created archive file and extracted it. The following files were extracted:

  • DONOTHING.txt
  • 1Thumbs.db
  • Thumbs.db.txt

It worked as you were expecting, and ignored the case of the file names.

I couldn't find a definitive guide to the syntax that should be used for the Prohibited file types field but this is from the manual:

File types to exclude from extracting If you enable this option, you can specify the list of potentially dangerous file masks in input field below. It is allowed to enter several masks separated by spaces. WinRAR will skip files matching any of these masks when extracting or opening archived files.

This option may help to protect users from infected email attachments. For example, if you enter:

*.scr *.pif *.exe

in this field, it will prohibit users to unpack, view and run .scr, .pif and .exe files with WinRAR.

In simple terms, if you separate each excluded file name/ file type with a space then you should have a working list of case insensitive files to skip on archive extraction.

Gaff

Posted 2011-04-22T14:58:50.780

Reputation: 16 863

I've entered thumbs.db .DS_Store in the prohibited file list. I have encountered a ZIP file that has a .DS_Store file in a 2nd level directory. (Zipfile.zip > Parent Directory > Directory where .DS_Store is stored). When I extract this ZIP file, WinRAR still extracts the .DS_Store file. Changing .DS_Store to *.DS_Store fixes this. My prohibited files list is now thumbs.db *.DS_Store. Anyone know why the previous entry didn't work in this case? – galacticninja – 2011-05-20T09:44:10.693

I got this email from WinRAR support answering my question in the above comment: "If file mask does not contain wildcard characters and does not contain path, it is valid only for root archive folder." – galacticninja – 2011-08-18T05:24:41.347

0

Try the pattern

*/Thumbs.db

and in specific case of *.DS_Store - you might need to enter the pattern

*.DS_Store

, because there could be files named ".DS_Store" and "._.DS_Store".

AnrDaemon

Posted 2011-04-22T14:58:50.780

Reputation: 95