I searched through man find but it doesn't give me the answer to a simple task:

I want to list all files inside a folder that were modified during the last 5 hours.

I tried

find ~/.purple/logs -type f -mmin 1000

to show modified files during the last 1000 minutes, but no hits.

Maybe it's my limited english, but what do I have to search for in the manual?

  • Try to read man ls. – Sigur Oct 6 '14 at 21:54
  • the same problem ;) I looked for "path" "full" but no solution in man ls – rubo77 Oct 6 '14 at 21:57
  • 1
    There are 2 options which can do what you want. -newer, and -mtime. – Patrick Oct 6 '14 at 21:58
  • but newer is for "newer than another file", sure I could create a temporary file and compare to that? – rubo77 Oct 6 '14 at 21:59

You can use

find . -maxdepth 1 -mmin -$((60*5)) -type f

to list all regular files in the current directory, which were changed during the last 5 hours.

$((60*5)) is calculated by the shell and therefore equal to 300 min.

| improve this answer | |
  • I see, the problem was, that in the manual there is not written that you have to prefix the minutes with a minus – rubo77 Oct 6 '14 at 22:09
  • @rubo77 it's explained in the beginning of the TESTS section. – terdon Oct 6 '14 at 22:10
  • If you know that there must be a minus, you find various hints in the man page, but not, if you dont expect such thing – rubo77 Oct 6 '14 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.