tar.bz2 exception to --exclude?
I'm writing a script to backup a joomla site. I'd like to exclude every file EXCEPT the index.html file in the /cache /tmp and /administrator/cache directories, but can't figure out how to do it. Here's my command line:
Code:
tar -cjf test.tar.bz2 joomla_16 joomla_16/cache/index.html joomla_16/cache/index.html joomla_16/administrator/cache/index.html --exclude "cache/*" --exclude "_*" --exclude "administrator/cache/*" --exclude "tmp/*" Thanks! Mike |
Well, a simple way would be to add the line
Code:
tar -Ajf test.tar.bz2 /cache/index.html /tmp/index.html /administrator/cache/tmp/index.html |
That makes sense, but I got this error when I tried it:
Code:
tar: Cannot concatenate compressed archives |
Ah, okay, what you can do is this (just tried it, so it definitely works... at least on my PC):
Code:
tar -cf test.tar joomla_16 joomla_16/cache/index.html joomla_16/cache/index.html joomla_16/administrator/cache/index.html --exclude "cache/*" --exclude "_*" --exclude "administrator/cache/*" --exclude "tmp/*" |
Wonderful, thanks for all your help. I'll give it a shot, but wanted to thank you first.
Mike |
If the problem's been solved, it's considered polite to mark the thread as 'SOLVED' (there's a link at the top of the page) :)
And posting a thank post like you did / clicking the reputation buttons is definitely good kudos, so well done for that :P |
All appears to work correctly, but it's not. When I try to open the tar.bz2 file I get this error:
Code:
tar: Skipping to next header |
*headslap*
So sorry. -A is appending tar files to an archive, but -r is appending files to the end of an archive. So -A would add two .tar files together, but -r would put the next file into the archive. |
[SOLVED] tar.bz2 exception to --exclude?
TYVM! That worked like a charm.... rep+++
|
All times are GMT -5. The time now is 06:31 AM. |