Reputation: 153
I need to generate from time to time a backup only from the new files, that are distributed in folders and subfolders, created after a given datetime. Is there a way of doing this, using a tar command line or a shell bash (I don't have GUI interface installed)? The structure of the directories need to be maintened.
Upvotes: 1
Views: 527
Reputation: 111389
tar
stores an entire directory tree by default. As to the date restriction: the man page of tar
(run man tar
in terminal) tells us there's an option for exactly that:
-N, --newer, --after-date DATE-OR-FILE
only store files newer than DATE-OR-FILE
The parameter is either a date or a file whose modification time will be used as a reference.
Example of using a date:
tar czf test.tar.gz -N '2014-10-30 12:34:56' MyDirectory
Upvotes: 2