Argument list too long - help

Tony Baldwin photodharma at
Wed Jun 10 18:52:36 UTC 2009

Carl Friis-Hansen wrote:
> I just discovered that ZoneManager has stored some 87000 png files in a
> directory.  I have no use of them and wanted to remove them.
> That turned out not to be so strait forward:
> carl at cjfh3:~$ rm Webcam_Pictures/*.png
> bash: /bin/rm: Argument list too long
> carl at cjfh3:~$
> How do I best come around this issue?

$ cd Webcam_Pictures
$ rm *.png
or, if the list of *.png is too long for rm to handle, maybe something 
like a loop.

$ cd Webcam_Pictures
$ for i in $(ls -l *.png); do rm $i; done
then it removes them one at a time, ie. you are only passing one file to 
rm at a time.


free/open source software
tcl yer os with a feather...

More information about the ubuntu-users mailing list