1

I wish to list down all files which were created on particular time.

(For ex: files created on time: Nov 13 09:09)

-rw-r--r-- 1 bitt1 cerillio     43268 Nov 13 09:02 sendEsbUpdateEvents.log
-rw-r--r-- 1 bitt1 cerillio    333420 Nov 13 09:09 jobwatch_bittest1.log
-rw-r--r-- 1 bitt1 cerillio   6113535 Nov 13 09:09 CDRExtract.log
-rw-r--r-- 1 bitt1 cerillio     10268 Nov 13 09:09 cdrextract_111309095100_26224.log
-rw-r--r-- 1 bitt1 cerillio 322398684 Nov 13 09:10 export_docs_log.log
-rw-r--r-- 1 bitt1 cerillio   2911940 Nov 13 09:14 sendBillNotifications.log

So let me know single liner query if any.

  • Have a look at this Super User answer. – garethTheRed Nov 13 '14 at 9:27
  • 1
    That time is the last modification time, not the creation time (unless you used ls -lU (inode birth time) on FreeBSD or derivatives) – Stéphane Chazelas Nov 13 '14 at 9:32
1

With GNU or FreeBSD find:

find . -newermt '2014-11-13 9:09' ! -newermt '2014-11-13 9:10'

Note that it will report a file last modified at 9:10:00.000000000 and not one at 9:09:00.000000000 but should otherwise be OK for the other 60,000,000,000 nanoseconds in between.

With GNU find, assuming file and directory names don't contain newline characters, you could also do:

find . -printf '%T+/%p\n' | grep -Po '^2014-11-13\+09:09.*?/\K.*'

(or if they may contain newline characters:

find . -printf '%T+/%p\0' | grep -Pzo '^2014-11-13\+09:09.*?/\K.*' | tr \\0 \\n
| improve this answer | |

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.