I'd like to run a nightly cron job that deletes all the files in a folder that haven't been accessed in a week or more. What is the most efficient way to do this in bash?
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
migrated from stackoverflow.com Jul 13 '11 at 1:01
|
You want the
(This will delete all files (only regular ones, no pipes, special devices, directories, symbolic links) in the given folder and all subdirectories (recursively) where the last access time is longer than 7 days ago.) |
|||||
|
|
You may want to check out |
|||
|

findcan filter based on atime. The "correctness" of atime depends upon configuration (seenoatime), at the very least. – pst Jul 12 '11 at 23:40