Tag Archives: touch

Finding new files with find

When looking for new files (or directories) with the find command, there is a difference between using mtime or ctime.

From the manual:

-ctime n
   File's status was last changed n*24  hours  ago.
-mtime n
    File's data was last modified n*24 hours ago.

This essentially means that if a file was touched (touch myfile), the file’s status was changed and ctime will pick this up:

$ find /path -type f -ctime -1

On the other hand, if the file’s content was changed, mtime will pick this up:

$ find /path -type f -mtime -1

When watching a directory for new incoming files, ctime is what you’ll want to use.

Posted in Linux | Tagged , , , , , | Leave a comment