Search code examples
linuxbashfindcygwin

Find command find directories that were created after a certain date under Linux/Cygwin


I want to use the find command to find these directories:

Access: 2013-12-13 10:59:46.190886900 -0500
Modify: 2013-12-03 07:04:02.995890600 -0500
Change: 2013-12-03 07:04:02.995890600 -0500
 Birth: 2013-12-02 07:04:02.000000000 -0500  (I want a time after '12-03')

This is the command I ran but it still lists older directories:

find . -type d -newerBt '2013-12-03 00:00:00' -exec du -h {} \;

How can I modify this line to find the directories created after that date? What is the difference between -newerct and -newerBt. I think I want the birth date.

Note: I am running this with the latest cygwin.


Solution

  • You could use stat instead:

     find . -type d -exec bash -c '(( $(stat -c %W "{}") > $(date +%s -d '2013-12-03') )) && du -h "{}"' \;