How to Find and remove 7 days before modified/created files
On my linux machine I have one folder and there some temporary files get created daily. I want to create one script or command which will delete all files which are created/modified before 7 days.
Here I want to keep last 7 days files.
find /somedir -mtime +7 .....
Just in case you start getting errors (although that's all you'll get because if you just use rm it won't remove directories), but you could add
in your find parameters to avoid the "cannot delete blah: directory" type errors.
|All times are GMT -5. The time now is 10:55 PM.|