LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   RAR - how do I exclude a subdir? (https://www.linuxquestions.org/questions/linux-software-2/rar-how-do-i-exclude-a-subdir-586874/)

z0diac 09-24-2007 01:44 AM

RAR - how do I exclude a subdir?
 
OK, I rar up my entire httpdocs directory for backup each week, EXCEPT one directory which is *huge* and I backup that separately.

So I want to add ALL files/dirs in my httpdocs EXCEPT one subdir called "datafiles" (httpdocs/datafiles/*)

Is this even possible with rar ??

I've tried dozens of command lines but none successful.

bathory 09-24-2007 02:40 AM

Iirc you should run:
Code:

rar a -r httpdocs.rar httpdocs/ -xhttpdocs/datafiles
Why don't you use tar instead of rar?

colucix 09-24-2007 03:06 AM

You can use find to exclude a specified subdir, as in
Code:

cd httpdocs
find . -maxdepth 1 -wholename ./datafiles -prune -o -print

you will likely to exclude the . at the beginning of the filelist, as for
Code:

egrep -v ^.$
putting all this together you will have something like
Code:

cd httpdocs
find . -maxdepth 1 -wholename ./datafiles -prune -o -print | egrep -v ^.$ | xargs rar a ../httpdocs.rar


z0diac 09-24-2007 11:41 AM

Quote:

Originally Posted by bathory (Post 2901708)
Iirc you should run:
Code:

rar a -r httpdocs.rar httpdocs/ -xhttpdocs/datafiles
Why don't you use tar instead of rar?

IT WORKED!

I had tried EVERY combination of variations EXCEPT that one (either put a space in after the -x or put it without but with that switch in the wrong place, etc).

You have no idea how much time you've saved me - I was rar'ing up every subdir individually which took HOURS each week before.

Thank you both for replying!!!

z0diac 09-24-2007 11:43 AM

Oh - I use rar instead because I use WIndows here at home... and since all my other home backups are rar'ed up with WinRar I just like to keep everything the same. Need rar's ability to split archive into multiple 500MB volumes too since I'm backing up a 90GB site.


All times are GMT -5. The time now is 10:49 AM.