Posted by & filed under Code Tips.

Fighting against an issue with the sendmail queue getting filled with junk I needed a way to delete a folder full of messages, and there were too many for rm to delete.

A post on Stack Overflow had the solution. Only thing I added was the -v option to rm so that it displays the files as they’re being deleted just to double check that something was actually happening.

for f in *.pdf; do rm -v "$f"; done

Leave a Reply

Your email address will not be published. Required fields are marked *