LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-24-2007, 01:44 AM   #1
z0diac
LQ Newbie
 
Registered: Sep 2007
Posts: 6

Rep: Reputation: 0
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.
 
Old 09-24-2007, 02:40 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Iirc you should run:
Code:
rar a -r httpdocs.rar httpdocs/ -xhttpdocs/datafiles
Why don't you use tar instead of rar?
 
Old 09-24-2007, 03:06 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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
 
Old 09-24-2007, 11:41 AM   #4
z0diac
LQ Newbie
 
Registered: Sep 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
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!!!
 
Old 09-24-2007, 11:43 AM   #5
z0diac
LQ Newbie
 
Registered: Sep 2007
Posts: 6

Original Poster
Rep: Reputation: 0
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how many files on a subdir ? graziano1968 Linux - General 2 08-09-2006 11:18 PM
extracting .rar with part01.rar? chime Linux - General 5 04-11-2006 06:59 PM
tar --exclude --exclude-from cefn Linux - Software 4 10-11-2005 07:31 PM
Why does sudo mkdir -m766 0/subdir deny? suguru Debian 1 11-08-2004 05:07 AM
deleting all *.m3u files in a directory+subdir? minm Linux - Newbie 5 10-12-2004 03:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration