Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to remove a folder when I'm creating a tar.gz file as it's for a backup and it takes too much space and is not required

I am using the following command;

tar -cvzf /home/backups/$STAMP-Earth.tar.gz /home/bukkit/

I do not want to include "/home/bukkit/plugins/dynmap" when creating the tar.gz

Any help would be appreciated.

share|improve this question
    
zip != tar. Please edit s/zip/tar. –  psusi Jan 8 '12 at 18:17
add comment

1 Answer 1

up vote 6 down vote accepted

You can use the following option to eliminate the folder/file you want.

--exclude=PATTERN

Your command becomes like:

tar -cvzf /home/backups/$STAMP-Earth.tar.gz --exclude=plugins/dynmap /home/bukkit/
share|improve this answer
    
Thanks works perfectly! –  Josip Gòdly Zirdum Jan 8 '12 at 17:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.