Need to know command to delete more than 3 million files from /var/spool/clientmqueue

Hi

I need to delete more than 3 million files from /var/spool/clientmqueue. When I give the following command to delete the files, I get the error

# pwd
/var/spool/clientmqueue
# rm -f *
/usr/bin/rm: arg list too long

Please tell me how can I delete the files

Presumably you are not starting "sendmail" but have applications (or cron jobs) which cause mail.
There is a discussion about this directory, why it can get high numbers of files, and how to clean it in this link.
Huge disk usage on /var/spool/clientmqueue - comp.unix.solaris | Google Groups
Check that the circumstances match yours before deleting all files.

You could try:

# cd /var/spool
# find clientmqueue -exec rm {} \;

Use this ONLY if you want to delete ALL messages in the queue.

HTH

This would be quite slow with 3 million files. A slight change ('+' vs '\;') will highly improve the removal performance:

# find clientmqueue -exec rm {} +
1 Like

Nice catch! :smiley:

My big thanks to methyl , bluescreen & jlliagre. Sorry for relying you late as I wasn't well.