Delete files created 5 mins or earlier in a folder
On CentOS, how can I delete files which are created 5 mins ago or earlier in a folder? Thanks!
Try using find:
find ./ -mmin -5 -exec rm -i '{}' \;
Simmilar to kce:
find /path/to/folder -type f -cmin -5 -print0|xargs -r0 rm
Added a search for files only and used cmin instead of mmin as you asked for files created in the past five minutes. I like to combine find with xargs.
In UNIX, we typically refer to them as directories, not folders. I used your name in the path above.