I'm trying to recursively find files that have not been accessed for over 365 days. I can use stat and verify that the file has not been accessed for over 365 days. It is odd that the file shows that it has been changed about 6 months ago, but again stat shows last access was over a year ago.
Then I try using the find command and searching for files that have not been accessed for over a year, but the file I verified is not listed:
skunkbad:/var/www/htdocs/newera$ stat ./index.html
File: './index.html'
Size: 31 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 3279283 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/skunkbad) Gid: ( 1001/ webdevs)
Access: 2018-01-08 16:22:58.271143975 -0800
Modify: 2017-09-21 14:01:36.950307771 -0700
Change: 2018-06-04 09:00:36.801632639 -0700
Birth: -
skunkbad:/var/www/htdocs/newera$ find . -atime +365 -type f -print
skunkbad:/var/www/htdocs/newera$
So, in this case, why isn't this index.html file listed by find? How can I recursively find files that haven't been accessed in over 365 days?
I'm asking because I intend to issue a command that touches these files, but I need to know that it's going to work. Example for 90 days:
find -type f -atime +90 -exec touch -a {} +
Asked by Brian Gottier
(123 rep)
Jan 7, 2019, 11:02 PM
Last activity: Jan 8, 2019, 07:49 AM
Last activity: Jan 8, 2019, 07:49 AM