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)?
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