Delete all files (except the four newest) throughout directories using a Bash script

Solution 1:

ls -t | sed '1,4d' | xargs echo rm

Remove the echo when you're satisfied that's the result you want.

If you have filenames with spaces, more work is required.