Argument list too long - help

Muzer muzerakascooby at gmail.com
Wed Jun 10 18:53:04 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?
>   
for f in `ls Webcam_Pictures/*.png`; do rm $f; done

Should work, obviously not tested. You might want to replace the rm with 
something harmless like "echo" first, just to make sure.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/CM/IT d>++ s+:- a---- C+++ UL+++>++++ P+>+++ L+++>+++++ E---->--- W+++ N o? K? w--- O+ M-- V- PS PE? Y-- PGP- t+ 5? X- R-- tv+ b++ DI D G++ e- h! !r y 
------END GEEK CODE BLOCK------





More information about the ubuntu-users mailing list