About deleting a files
Hi.
I got a mission. It's to delete some files in a folder that was created before in a specified date. I only know to use ls -la to check files date. But the problem is there are too much files and lots documents directory.. Is there a way to check the files date and delete them? thx for help. |
Use find in conjunction with exec, e.g.
Code:
find . -mtime +5 -mtime -7 -exec rm -i {} \; Note that I've specified the -i flag to rm to make it prompt before removing a file. This is always a good idea when doing magic with find + rm to make sure you only remove the files you want to remove. Remember, there's no undelete on the command line (alternatively you could mv the found files to another directory for later perusal/removal, e.g.: Code:
find . -mtime +5 -mtime -7 -exec mv {} ~/files_for_deletion/ \; |
All times are GMT -5. The time now is 04:20 AM. |