Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Next: , Previous: Wildcards, Up: Choosing


6.6 Operating Only on New Files

The --after-date=date (--newer=date, -N date) option causes tar to only work on files whose data modification or status change times are newer than the date given. If date starts with ‘/’ or ‘.’, it is taken to be a file name; the data modification time of that file is used as the date. If you use this option when creating or appending to an archive, the archive will only include new files. If you use --after-date when extracting an archive, tar will only extract files newer than the date you specify.

If you only want tar to make the date comparison based on modification of the file's data (rather than status changes), then use the --newer-mtime=date option.

You may use these options with any operation. Note that these options differ from the --update (-u) operation in that they allow you to specify a particular date against which tar can compare when deciding whether or not to archive the files.

--after-date=date
--newer=date
-N date
Only store files newer than date.

Acts on files only if their data modification or status change times are later than date. Use in conjunction with any operation.

If date starts with ‘/’ or ‘.’, it is taken to be a file name; the data modification time of that file is used as the date.


--newer-mtime=date
Acts like --after-date, but only looks at data modification times.

These options limit tar to operate only on files which have been modified after the date specified. A file's status is considered to have changed if its contents have been modified, or if its owner, permissions, and so forth, have been changed. (For more information on how to specify a date, see Date input formats; remember that the entire date argument must be quoted if it contains any spaces.)

Gurus would say that --after-date tests both the data modification time (mtime, the time the contents of the file were last modified) and the status change time (ctime, the time the file's status was last changed: owner, permissions, etc.) fields, while --newer-mtime tests only the mtime field.

To be precise, --after-date checks both mtime and ctime and processes the file if either one is more recent than date, while --newer-mtime only checks mtime and disregards ctime. Neither does it use atime (the last time the contents of the file were looked at).

Date specifiers can have embedded spaces. Because of this, you may need to quote date arguments to keep the shell from parsing them as separate arguments.

Please Note: --after-date and --newer-mtime should not be used for incremental backups. Some files (such as those in renamed directories) are not selected properly by these options. See Incremental Dumps.

 
 
  Published under the terms of the GNU General Public License Design by Interspire