|
|
#1 |
|
Registered User
Join Date: Sep 2004
Posts: 35
|
recursive tarball
hey, does anyone know how to omit a few directories when making a tarball recursively.
Lets say Code:
Yet there are certain directories inside foo_dir I want the tarball to omit. How would I go about doing something like that. Thanks for your time, Dave |
|
|
|
|
|
#2 |
|
Da House Nerd
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
|
tar itself can't do it, but I would do it using find. Find can handle regexps.
see man find especially the OPERATORS section. one example from the manual: find / \! -name "*.c" -print Print out a list of all the files whose names do not end in .c. in complete the command would be something like tar -cvzf myfile.tar.gz `find . -name "bla" | xargs` for a backup it might be interesting to use the -j flag instead of the -z flag, since bzip2 compression is much better than gzip compression. |
|
Linux virusscanner detected a virus: Windows 95 ... delete [Y/n] y ~ ~ :wq |
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Sep 2004
Posts: 35
|
Thanks you so much, this is exactly what I needed.
|
|
|
|
|
|
#4 |
|
Registered User
Join Date: Sep 2004
Posts: 35
|
hey one more thing greffov. How can I put a regular expression inside the -name paramater. Or is that impossible. If not I can always pipe it into grep but I would like to do something like this but its not working.
find . -name "*\.(html|php)" -print |
|
|
|
|
|
#5 |
|
Da House Nerd
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
|
find . -(i)regex ".+\.(html|php.{0,1})" | xargs
I haven't tried the pattern, you might have to use -E to enable extended regular expression syntax. b.t.w.: for those that feel very lost when reading this, don't worry -- it's just something you'll never be able to do with any GUI. |
|
Linux virusscanner detected a virus: Windows 95 ... delete [Y/n] y ~ ~ :wq |
|
|
|
|
|
|
#6 | |
|
PCTT Administrator
Join Date: Mar 2003
Location: Las Vegas
Posts: 3,735
|
Quote:
Good because i have no idea what any of that means! Usually when i see that many symbols together they mean someone is cussing! |
|
|
|
|
|
|
#7 | |
|
Registered User
Join Date: Sep 2004
Posts: 35
|
Quote:
Thanks for all the help... I had a few problems at first, but I found that I needed to escape all metacharacters except these [].* this worked fine -> -iregex '.*\.\(html\|php\)' |
|
|
|
|
|
|
#8 |
|
Da House Nerd
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
|
great
![]() can you post up the final complete command to make the tar here, just for reference? (and to make others possibly even more lost ;-) ) b.t.w.: why do you write ".*\.(html|php)" ? Do you have files named .html or .php that you want to be included? |
|
Linux virusscanner detected a virus: Windows 95 ... delete [Y/n] y ~ ~ :wq |
|
|
|
|
|
|
#9 |
|
Registered User
Join Date: Sep 2004
Posts: 35
|
About my files being .html or .php. I see where you're going. But since I can't figure out a way to enable "extended regular expression" I was unable to do a +*
I could always substitute a ..* for a +* but that still wouldn't achieve what you want because the results from the find return the relative or absolute paths. So I tried doing something like this [^/] .* but for some reason that doesn't match anything. Oh well, in the meantime this works nearly perfect. Code:
Reason i'm doing this is because the only linux box I have access to is my web host, and I'm going use this as a cron job to backup some stuff. PS: Cool Linux Reference Site/Book |
|
Last edited by section31 : 12-05-2004 at 06:41 PM. |
|
|
|
|
|
|
#10 |
|
Tire Master DJ
|
thats what my head felt like after reading this made me cross eyed ![]() |
|
Tiremonkey2000 |
|
|
|
|
|
|
#11 |
|
Registered User
Join Date: Sep 2004
Posts: 35
|
hey what does that thing below user's avatars do. "Add to reputation" I put something for greffov thinking it would go in his profile or something...but nothing. Where does it go.
|
|
|
|
|
|
#12 |
|
Da House Nerd
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
|
I dunno, it adds on my balance or something. You can see it in your control panel.
|
|
Linux virusscanner detected a virus: Windows 95 ... delete [Y/n] y ~ ~ :wq |
|
|
|
|