tar, excluding directories recursively
I have tried man and info for tar, as well as google
and this site, but just cant find what i need.
I want to make a tar and exclude 2 directory
trees recursively. Everything i've seen says to use
--exclude, but that doesn't seem to work for me.
Anyway, doesn't that option only work with patterns?
And isn't it impossible to express a dir tree recursively
thru a pattern?
Also have the option to make a big exclude list, but
these are directories with many small files, and that
seems like a big waste of power.
Here is a link to the script i'm trying to use, everything
works except that tar won't excluded the directory trees:
Thanks in advance
From what I understood, if you want to exclude directories recursively from tar, the command --exclude should work fine! Even if you can only use patterns and not regexp, you can still make it do what you want (from what I know!)
So , to use --exclude, here is the syntax:
tar -cf tarball.tar --exclude=pattern filelist
so maybe just rewriting
tarOptions="-c -P --preserve --exclude /home/justin/archive/mysql/manual/ /home/justin/archive/php/ -f
tarOptions="-c -P --preserve --exclude=home/justin/archive/mysql/manual --exclude=home/justin/archive/php -f
and execute it from the / directory would work.
This will exclude everything in /home/justin/archive/mysql/manual recursively.
Hope this will help you! I still have a lot to learn, so tell me if this doesn't work!!
I will try this tonite.
many thanks, arobic!
this worked with the following modification: added * to the end of the pattern,
so it reads like this:
if anyone is interested, the new script can be found here:
|All times are GMT -5. The time now is 06:10 PM.|