LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-13-2012, 10:27 AM   #1
Rabowke
LQ Newbie
 
Registered: Aug 2012
Posts: 2

Rep: Reputation: Disabled
Specific RAR question: Exclude root directory of the RAR archive


hi folks,

I've a problem creating an archive with the following "requirements":

example folder structure:

folder x
subfolder x/sub1
subfolder x/sub2
subfolder x/sub3
file x/f1.bla
file x/f2.bla

I have to create a an archive with root folder x and all it's subdirectories and files, but without the files in the root folder x.
in other words, I want to archive folder x but exclude any of the files x/f1.bla, x/f2.bla, ...

I have to use wildcards to exclude the files in the root, so I cannot exclude them explicitly by -xf1.bla -xf2.bla, ...

I have to include all subdirs and cannot rely on adding them explicitly by their foldername.

rar a -r x/*.* -xx/*.* doesn't work, because in this case: "no files to add"

using first rar a -r x/*.* and then with a second command trying to remove the files in the root does delete the whole archive:

rar d -r- x/*.*

doesn't work even when using -r- which should disable folder recursion.


any hints for solving this ? didn't finy anything related to my problem using google or searching this board. I've also spent quite some time in playing around with the rar options, but without success.

your suggestions are highly appreciated
 
Old 08-13-2012, 02:14 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,353
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
Quote:
Originally Posted by Rabowke View Post
I have to use wildcards to exclude the files in the root
Why would you have to?


Quote:
Originally Posted by Rabowke View Post
I have to include all subdirs and cannot rely on adding them explicitly by their foldername.
AFAIK RAR recurses sub directories by default.


Quote:
Originally Posted by Rabowke View Post
I have to create a an archive with root folder x and all it's subdirectories and files, but without the files in the root folder x.
Use an exclusion list?
Code:
find x -maxdepth 1 -type f > /path/to/excludes
rar a /path/to/archive.rar x -x@/path/to/excludes
 
Old 08-13-2012, 04:43 PM   #3
Rabowke
LQ Newbie
 
Registered: Aug 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
exclusion list that's created at runtime .. that will do the job.
thank you for the hint unSpawn.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
.rar archive mrizz18540 Linux - Newbie 6 05-16-2009 02:20 AM
insert archive in .rar infonlinebr Linux - Newbie 4 03-30-2009 07:31 PM
question on how to rar multiple files into there own rar file steve51184 Linux - Software 13 10-24-2007 04:23 PM
RAR - how do I exclude a subdir? z0diac Linux - Software 4 09-24-2007 11:43 AM
.rar archive help Fredstar Linux - Newbie 1 02-09-2005 03:11 AM


All times are GMT -5. The time now is 12:40 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration