[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Argument list too long



On Fri, Dec 19, 2003 at 11:47:32AM +0200, Dobai-Pataky Balint wrote:
| 
| i have a webcam logging all motion into jpgs, my php code does lots with
| it, except after i convert selected jpgs copied into the workin' folder,
| and after conversion i'd like to rm them from php or by hand it'll give:
| rm *.jpg
| su: /bin/rm: Argument list too long

The problem is that the shell has a hard limit on the size (in bytes)
of commands.  This limit is quite large (many times larger than
cmd.exe on windows!) and you won't often run into it, except for
example when using '*' in a large directory.

| so i have to enter mc, enter the directory and F8 them out.
| 
| how could i do a right rm?
| (without generating a shell pattern to rm them in separated groups)

Another option, not yet given, is :

find . -name \*.jpg | xargs rm


Read the manpages for find and xargs.  find lists all
files/directories matching the given criteria on stdout.  xargs reads
stdin and executes the specified command on the arguments found on
stdin.

-D

-- 
\begin{humor}
Disclaimer:
If I receive a message from you, you are agreeing that:
   1. I am by definition, "the intended recipient"
   2. All information in the email is mine to do with as I see fit and make
        such financial profit, political mileage, or good joke as it lends
        itself to. In particular, I may quote it on USENET or the WWW.
   3. I may take the contents as representing the views of your company.
   4. This overrides any disclaimer or statement of confidentiality that may
        be included on your message
\end{humor}
 
www: http://dman13.dyndns.org/~dman/            jabber: dman@dman13.dyndns.org

Attachment: pgp6jtqynZgU5.pgp
Description: PGP signature


Reply to: