bash: /bin/rm: Argument list too long

I came across this error when trying to delete lots of files on Debian Squeeze. This error apparently occurs due to the reason that the system commands show limitations when a large number of arguments are fed into a single command.
 
so I created a bash script called bulkrm containing
 
for i in *; do
rm -f $i;
done
chmod +x bulkrm
../bulkrm
 
(WARNING THIS WILL DELETE ALL FILES IN THE FOLDER IT'S EXECUTED FROM SO USE
AT YOUR PERIL)
 

You may also like

Leave a Reply

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