I want to delete all files that are bigger then 20MB in a folder called /var/www/cg/ I found this on google: find / -size +2000000c 2>/dev/null -exec ls -l {} \; I ran it in the directory /var/www/cg/ and thought it would only delete the files in the current directory but it didn't it deleted every file on the server bigger then 20 MB so I skipped it as fast as possible... Can someone tell me how to delete files bigger then 20MB only in that certain directory?
find /var/www/cg/ -size +20M -exec ls -l {} \; Code (markup): That should list all the files over 20M find /var/www/cg/ -size +20M -exec rm -f {} \; Code (markup): That should delete them, no confirmation is given.