I understand that it is possible to use find to locate files that were created during a specified range of time. For example, the following should output a list of all the files created (inode change status) at the midnight hour of of January 1st, 2021:

find . -newerct "2021-01-01 00:00:00" ! -newerct "2021-01-01 01:00:00"

I want to find all of the files created during the midnight hour regardless of the date that they were created. Is there a good way to do this?

find . -newerct "ANY-ANY-ANY 00:00:00" ! -newerct "ANY-ANY-ANY 01:00:00"

1 Answer 1


Make use of find (with -print0) and xargs -0 to feed all the filenames to a stat command, and filter the results:

find . -type f -print0 |\
  xargs -0 -r stat --format="%y %N" |\
  grep -E '^00:' |\
  cut "-d " -f2-

Read man find xargs stat cut

  • Would this be fairly safe to use in conjunction with the --files-from argument in rsync? Apr 26, 2021 at 14:47
  • Probably not. My example reliably preserves spaces and funny characters in filenames, which you would have to quote. The technique is reusable. What is "safe"?
    – waltinator
    Apr 26, 2021 at 18:58

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.