deriklogov
asked on
Remove files in unix
Hello,
Could you please tell me how to find all image files which older than 3 monthes in specific directory and in all subdirectories
Could you please tell me how to find all image files which older than 3 monthes in specific directory and in all subdirectories
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
did you wanted to delete ?
atime is to look by access time
and mtime is to look by modification time.
you can use as per your requirement.
atime is to look by access time
and mtime is to look by modification time.
you can use as per your requirement.
find /dir -name '*.jpg' -atime +90 -exec rm -rf {} \;
But to confirm you can slightly modify this as:
find /dir -name '*.jpg' -atime +90 -exec ls -ld {} \; >> /tmp/any_file
cat /tmp/any_file
so now if you want you can directly execute the first step or you can select the particular files from /tmp/any_file for selected removal.
But to confirm you can slightly modify this as:
find /dir -name '*.jpg' -atime +90 -exec ls -ld {} \; >> /tmp/any_file
cat /tmp/any_file
so now if you want you can directly execute the first step or you can select the particular files from /tmp/any_file for selected removal.
you can replace / by your directory path and jpg with image extensions that you want to look for.
Hope this helps