0

How to list files that has last read-access older than 6 months? Then, how to delete them?

My filesystem seems to be mounted with:

/dev/sda3 on /home type ext4 (rw,relatime,data=ordered)
  • On the whole machine, in your home directory only, or...? Have you looked at the find command with the -atime option? – Stephen Harris Sep 14 '16 at 22:58
  • @StephenHarris in a specific directory containing ~ 2000 files. – Basj Sep 15 '16 at 12:40
0

Here is how to list them (NB: 180 stands for 180 days):

find . -atime +180

Here is how to move them:

find . -atime +180 -print0 | xargs -0 mv --target-directory=../oldfiles/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.