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.

Is there a way to for the tar command to check for new files that are not already in the archive, or those that have been deleted (for good measure)?

share|improve this question
add comment

1 Answer

You could use tar -d to see if local filesystem files are different or missing.

To add new files, just use tar -u to add only files newer than the copy in the archive.

tar -cvf /tmp/backup.tar /home # adds all files
echo Hello > /home/newfile.txt
tar -uvf /tmp/backup.tar /home # adds only newfile.txt
rm /home/newfile.txt
tar -df /tmp/backup.tar /home # gives an error about newfile.txt missing
share|improve this answer
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.