I am trying to discover a modified file from a certain day. I have been using find . -mtime -2 but I need to go back even further, this past Thursday and just Thursday.
I am not anywhere near proficient in unix commands so any help would be awesome.
Thanks
If you want to find files that were modified after last Thursday use this command
find . -newermt 'last Thursday'
Before last Thursday
find . -type f \
-not \
-newermt "2012-12-13 00:00:00"
Only Thursday
find . -type f \
-newermt "2012-12-13 00:00:00"
-not \
-newermt "2012-12-14 00:00:00"
The last Thursday was 2012-12-13. When you search any file that has modification date lower than Thursday in find it should be -not newermt '2012-12-13'. When you search Only files modified on this Thursday its lower than Wednesday but greater than Thursday. And yes you can omit 00:00:00 part if you wish.
Note: POSIX find does not have -newerXY. It has only -newer. To convert -newermt "2012-12-13 00:00:00" use this.
touch -d "2012-12-13 00:00:00" pointA
find . -type f \
-not \
-newer pointA
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