How to find files that were created or modified based on a particular timestamp.

Let's say timestamp be date +%d-%m-%y_%H.%M

Could you suggest a command which fetches files based on a particular a timestamp ?


You could use the following command:

find /path/to/dir -newermt "yyyy-mm-dd HH:mm:ss" -not -newermt "yyyy-mm-dd HH:mm:ss+1"

This command will list file in the folder /path/to/dir modified between yyyy-mm-dd HH:mm:ss and yyyy-mm-dd HH:mm:ss + 1 second

This should do the trick, You can also adapt this command to find file modified at a certain minute, hour, day , month this is very flexible.

If you want to find file by access time, you can tune it like this:

find /path/to/dir -newerat "yyyy-mm-dd HH:mm:ss" -not -newerat "yyyy-mm-dd HH:mm:ss+1"

And if you want only the creation time:

find /path/to/dir -newerct "yyyy-mm-dd HH:mm:ss" -not -newerct "yyyy-mm-dd HH:mm:ss+1"

This command search between the two date you mention the first date being inclusive and the second exclusive; it find file modified at or after date 1 and before date 2.

you want more information look at this blog article it's nice: Find Files Modified On Specific Date

  • Thank you Kiwy it is working perfectly as my requirements and do we need to use same kind of time format for find command?? – santhosh gupta Feb 15 '18 at 10:03
  • I have no idea I can't manage to find more information about the date format but this one works properly. – Kiwy Feb 15 '18 at 10:15

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.