I am trying to remove large amount of mails (mostly mail delivery failed) from my server using
rm -rf /home/*/mail/new/*
And I am getting
-bash: /usr/bin/rm: Argument list too long
I tried using find
find /home/*/mail/new/ -mindepth 1 -delete
But after 20 minutes it looks like it's not doing anything.
How do I use for loop to delete everything (directories, files, dotfiles) within
Something like this
for f in /home/*/mail/new/*.*~; do # if it is a file, delete it if [ -f $f ] then rm "$f" fi done
Please help me rewrite this command to delete files AND folders and everything within
EDIT: My question is unique because it's about doing that in FOR loop.