Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Single user mode: Argument List is too long, PLEASE HELP

Hey guys,

I recently posted a topic asking if any1 knew how to delete all png files on the desktop,

Nt many people replied,

But anyway, I did some research and now I know how to do it,

but in single user mode (cmd + S),

When I typed in rm *.png

While I ws on the desktop in single user mode,

It came up saying Argument list too long,

Does any1 know how to fix this,

Plz reply ASAP,

& if possible addme on Skype mark.davidson19, it wld b extremely helpful

iMac, iOS 4.3.3, This mac is about 6 months old

Posted on Sep 5, 2012 9:01 AM

Reply
4 replies

Sep 5, 2012 10:51 AM in response to -_-SwagR

If there are too many files expanded via the *.png wildcard, then the argument list length maximum can be exceeded. The last time I checked, Mac OS X had a 256K line length limitation. (AIX was 1M, Linux 128K, Solaris 1M, Windows 8K (Cygwin env) - your mileage may vary with each operating system release).


If you have too many files to expand on the command line, then you can delete them in batches. There are several ways to do this


cd ~/Desktop

rm [a-m]*.png

rm [n-z]*.png

rm [A-M]*.png

rm [N-Z]*.png


Or finer increments.


You could use something like


find ~/Desktop '*.png' -print0 -depth 1 | xargs -0 rm


And you can also use


find ~/Desktop '*.png' -depth 1 -delete


This being a Unix environment, there are most likely a dozen additional ways to delete all the .png files and avoid command line length limits.


As MrHoffman says, using rm and wildcards is a very dangerous thing to do unless you really REALLY know what you are doing. If not, I strongly suggest having a recent full backup handy. I actually suggest a backup regardless of how good you are in the Unix environment (I have multiple via different backup utilities preformed on a very regular basis; years of experience has taught me you cannot be too careful with your data - it is worth far more than the cost of backup equipment).

Single user mode: Argument List is too long, PLEASE HELP

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.