Linux Find Command – How to Find All Files Older Than One Minute

findlinux

How can I use find to select files that have been written and not modified in the last minute?

I know I can do it the other way around, find files modified in the last 60 seconds with -mtime -60s, but I want the ones that haven't been modified in the last 60 seconds.

I use Linux and get this error if I use seconds:

find ??/ -mtime +60s -name blah.tsv
find: invalid argument `+60s' to `-mtime'

Best Answer

Use find /path -type f -mtime +60s

The - just before the digits is not a regular "argument dash", but means "less than". + then is "more than".

From man find:

All primaries which take a numeric argument allow the number to be preceded by a plus sign (``+'') or a minus sign (``-''). A preceding plus sign means ``more than n'', a preceding minus sign means ``less than n'' and neither means ``exactly n''.

It should be noted that for exactly n, the time is rounded. So 1 (1 day) does not mean 86400 seconds.