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.
You could start by saying find /var/dtpdev/tmp/ -type f -mtime +15 . This will find all files older than 15 days and print their names. Optionally, you can specify -print at the end of the command, but that is the default action.
To search for a directory, use -type d. -printf '%T+ %p\n' prints the last modification date & time of file (defined by %T) and file path (defined by %p). The \n adds a new line. Sort | head -n 1 it sorts the files numerically and passes its output to the head command which displays the 1 oldest file.
Using the Find Command The “find” command allows you to search for files for which you know the approximate filenames. The simplest form of the command searches for files in the current directory and recursively through its subdirectories that match the supplied search criteria.
You could use stat instead:
find . -type d -exec bash -c '(( $(stat -c %W "{}") > $(date +%s -d '2013-12-03') )) && du -h "{}"' \;
You are finding
directories, but showing files contained therein.
Those files may have birth dates that lie before that of the containing directory. For example, create a file, then a directory, and move the file into that directory.
This is the difference between birth date and change date. If a file is moved into the dir, the dir is changed, so I think -newerct
is what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With