How can I Get a list of all files modified , say 3 months ago. I checked this question but I was not able to apply it to my scenario. I am trying this now , it seems to be working , but I know there should be a better way using find.

ls -ltR | grep -v '2011-05' | grep -v '2011-06' | grep -v '2011-07' | grep -v '2011-08

One solution is: find -type f -mtime 90

That finds files that was last modified exactly 90 days ago.

find -type f -mtime -90 finds files that were modified in last 90 days.


As @hknik says, the -mtime operation on find is likely your best bet, but if you want to get all files around three months ago, then you need a bigger net:

find . -type f -mtime -105 -mtime +77

This will find the regular files in the month surrounding three months ago, between 11 and 15 weeks ago.


With zsh and (.m[-|+]n) glob-qualifiers:

print -rl -- *(.m90)

will list files modified exactly 90 days ago,

print -rl -- *(.m-90)

will list files modified in the last 90 days,

print -rl -- *(.m-100m+80)

will list files modified between 80 and 100 days ago.

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.