Sami88
Sami88

Reputation: 45

Bash - How to find files that are not modified within a given time period?

I must find and list the first 10 files in a number of directories that have not been modified in the last 10 minutes.

My initial answer was: find . -mindepth 0 -type f -not -mtime 10 -ls | head

But that was marked as wrong likely due to the use of "-not". I need to know why, and what the correct answer is. Thanks!

Upvotes: 0

Views: 245

Answers (1)

glenn jackman
glenn jackman

Reputation: 246764

Here's another approach (probably requires GNU coreutils)

touch -d "10 minutes ago" refFile
find . -type f -not -newer refFile

Upvotes: 1

Related Questions