Friday, April 26, 2024
 Popular · Latest · Hot · Upcoming
37
rated 0 times [  37] [ 0]  / answers: 1 / hits: 136127  / 1 Year 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

 Answers
4

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: http://www.gnu.org/software/tar/manual/html_node/how-to-update.html


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

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

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