LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Specific RAR question: Exclude root directory of the RAR archive (https://www.linuxquestions.org/questions/linux-newbie-8/specific-rar-question-exclude-root-directory-of-the-rar-archive-4175421865/)

Rabowke 08-13-2012 10:27 AM

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 :)

unSpawn 08-13-2012 02:14 PM

Quote:

Originally Posted by Rabowke (Post 4753165)
I have to use wildcards to exclude the files in the root

Why would you have to?


Quote:

Originally Posted by Rabowke (Post 4753165)
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 (Post 4753165)
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


Rabowke 08-13-2012 04:43 PM

exclusion list that's created at runtime .. that will do the job.
thank you for the hint unSpawn.


All times are GMT -5. The time now is 07:00 AM.