I know I can use this command to find directories created or modified less than a week ago:
find /home -type d -mtime -7
But how do I find directory that were created less than a week ago?
-mtime +0 matches any file whose mtime difference is at least 24 hours. Tf you want mtime to count calendar days, and not n-24 hour periods from now, use -daystart : -daystart -mtime 0 is means today and -daystart -mtime +0 means before today. Also you can find only files with adding -type f or only dirs -type d .
You can use the find command to find all files that have been modified after a certain number of days. Note that to find files modified before 24 hours ago, you have to use -mtime +1 instead of -mtime -1 . Save this answer.
Creation time is not stored.
There is only 3 timestamps you can check
Last access time
Last modification time
Last change time
"Change" is one of: permission changes, rename etc. While the modification is contents only.
Short answer: you can't.
There are three times stored in an inode
The point is: ctime is altered not only by create, but also by chmod / chown, maybe even by ln (not sure). Man stat
and man touch
are your friends.
If you try to find fresh directories by means of find /home -type d -mtime -7
be prepared to also find older directories that had their mode or owner changed.
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