To check whether a directory is created today or not
Hi all,
I want to check whether a particular directory is created today or not.How can i?? Thanks in advance. |
it depends on the filesystem. I think you can do it on ntfs, but not available on ext4
|
Try the stat cmd http://linux.die.net/man/1/stat, but note that historically, *nix doesn't have a concept of 'creation time'
https://en.wikipedia.org/wiki/Stat_%28system_call%29 Very recently, moves have been made to provide a 'birth time' as well, but this is not generally implemented as of yet. |
Try doing like this
# ls -dl directory This'll show you tha date and time of creation of the directory, along with permissions although Look for the info by the end of the STDOUT Cheers! |
As already mentioned, you cannot see the file creation time in Unix. So a little hope is to search the directory by it's last modified time. Or on the other hand, if directories are created using some script (or even manually), create them with time stamp in their names as:
Code:
~$ find /path/to/search -name 'dir_name' -mtime -1 -type d -print |
Code:
$ find /source-path -type d -newermt $(date +"%Y-%m-%d") |
All times are GMT -5. The time now is 12:05 PM. |