LendKey

Thursday, January 1, 2009

RAR command line - to exclude files and folders

After many try&fail, I finally figured how to exclude files and subfolders when archiving with RAR command line.
Basically I tried to archive a folder with .svn subfolders. I definitely want to exclude them from the archive. But when I tried:
rar a -r -x.svn myarchive 

It did not exclude any .svn folders in second or deeper level of folder hierarchy.
Now the correct way is:
rar a -r  -x.svn -x*/.svn -x*/.svn/* -x*/anotherSubFolder -x*/anotherSubFolder/* myarchive

It will exclude all folder and subfolders with name .svn or anotherSubFolder.
Happy Year 2009!

Li

5 comments:

Alex said...

Some months ago I did patent and some important rar files were corrupted and I used this software-download software for repairing rar file,briefly speaking it helped me,program has free status as far as I remember,it can too analyzes and extracts files of any format from rar archives,program will work on any PC, it supports Windows NT 4.0, Windows XP SP2, Windows XP, Windows 98, Windows Vista, Windows Me and Windows 2003,shows archive structure and the right one displays a list of files, that were identified,will extract only integral documents, that can be retrieved by .rar file repair without errors.

Anonymous said...

I often had problems with rar file,such problems as: corrupted or deleted rar file,on reason: viruses,hackers and...But accidentally my friend advise-rar file repair.And tool solved my issues,more of this tool is free as far as I know,and it is able analyzes and extracts files of any format from rar archives,program will work on any PC.

Ludovic Kuty said...

Try -x***/.svn instead

Anonymous said...

Hi thanks a bunch!
For FWIW:
On Microsoft Windows the switches need BACKSLAHES as separators:
-x.svn -x*\.svn -x*\.svn\*

Anonymous said...

Thanks!