Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have compressed a folder using tar like this:

tar cvfz folder.tar.gz folder/

Now, say I have changed some of the files in that folder, added some and removed some. And now I want to update my archive.

Is there a way I can sort of only compress the changes? So that files in the folder that has not been changed won't be recompressed?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Tar and GZip are 2 independent things. GZip can only compress one file and Tar can join a lot of files and folders in one file. So, you need to ugzip your tar, update tar and finally gzip it. In your case it's better to use ZIP or 7-Zip.

Look at this link, 7-zip can easily compress all you like this way Or, you can use tar -u, but it will take more time to ungzip and gzip it again.

share|improve this answer
    
That's what I was afraid of. Tried out the -u option as well and it doesn't seem to update the tar file but rather just add the updated files at the end of the tar. Which means the tar file would grow and grow. –  Svish Jul 28 '10 at 14:42

tar stands for tape archiver, thus it "emulates" tapes even when using it with file archives. That's the reason it only appends instead of updating and the behaviour you are asking for is not possible with tar. Sorry.

But since we're talking about tar, have you ever tried star?

share|improve this answer

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.