Saturday, September 23, 2023
 Popular · Latest · Hot · Upcoming
rated 0 times [  37] [ 0]  / answers: 1 / hits: 136035  / 6 Months ago, thu, march 30, 2023, 7:38:27

I have created a tar.gz file (using the GUI, not the command line). How can I update it with a command that new files are added and modified files are updated, too?

More From » tar


You'd normally use the -u flag for this. From tar's man page:

 -u, --update
only append files newer than copy in archive

so this sequence will do what you need:

# First create the tar file. It has to be UNCOMPRESSED for -u to work
tar -cvf my.tar some-directory/
# ... update some files in some-directory
# ... add files in some-directory
# Now update only the changed and added files
tar -uvf my.tar some-directory/
# Compress if desired
gzip my.tar

For a slightly more detailed look, see here:

[#32233] Saturday, April 1, 2023, 6 Months  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 102
Total Questions: 122
Total Answers: 119

Location: Netherlands
Member since Thu, Jul 1, 2021
2 Years ago