Re: Argument List too Long

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

 



This is right from the man pages...

basically it takes stdout and you pipe to stdin ... but it basically handles
each argument one at a time instead of in a batch.


find /tmp -name core -type f -print | xargs /bin/rm -f

       Find files named core in or below the directory /tmp and delete
them.  Note that this will work incorrectly if there are any filenames
containing newlines or spaces.

       find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f

       Find  files  named  core in or below the directory /tmp and delete
them, processing filenames in such a way that file or directory names
containing spaces or newlines are
       correctly handled.

       find /tmp -depth -name core -type f -delete

       Find files named core in or below the directory /tmp and delete them,
but more efficiently than in the previous example (because we avoid the need
to use fork(2) and  ex-
       ec(2) to launch rm and we don’t need the extra xargs process).


On Wed, Jun 2, 2010 at 5:39 AM, vipin sagar <sagar.vipin@xxxxxxxxx> wrote:

> Hi,
>
> I had a same message[Argument List too Long] on AiX while deleting[rm] a
> bunch of log files start with Y_0*
> And to remove those in one shot I snipped the following.
>
> sagar > find <DIR> -type f -name "Y_0*" -exec rm -f {} \;
>
> This worked for me and still follows the rule 15 * * * * .
>
> Hope that shed some lights for you.
>
> --
> ~O_0~
> ~sagar
> http://vipinsagar.net
> *...i’ve to look back when i heard a gong! i could only see a huge cobweb
> and its shining, just got wonder, what the time it was…*
> *sagar*
>
>
> On Sun, May 30, 2010 at 9:04 AM, Geofrey Rainey
> <Geofrey.Rainey@xxxxxxxxxx>wrote:
>
> > Hi,
> >
> > I'm not the original poster but am interested in this thread and in
> > particular the "xargs" command. I'm not familiar with it, what is it and
> > how does one use it?
> >
> > thanks.
> >
> > -----Original Message-----
> > From: redhat-list-bounces@xxxxxxxxxx
> > [mailto:redhat-list-bounces@xxxxxxxxxx] On Behalf Of Cliff
> > Sent: Sunday, 30 May 2010 2:41 p.m.
> > To: General Red Hat Linux discussion list
> > Subject: Re: Argument List too Long
> >
> > Why not just use xargs?
> >
> > Sent from my iPhone
> >
> > On May 29, 2010, at 9:42 PM, "Carl T. Miller" <carl@xxxxxxxxxx> wrote:
> >
> > > Sanjay Chakraborty wrote:
> > >> I have a script and that run every month, In the script it has a mv
> > >> command and that moves about 35000 files from one directory to other
> > >> directory. In one system it is working but in other system I am
> > >> getting "Argument List too Long" error message.
> > >>
> > >> mv* ../$directory2/ cannot work.
> > >
> > > Try this:
> > >
> > > ls | while read file; do mv "$file" ../$directory2; done
> > >
> > > c
> > >
> > >
> > > --
> > > redhat-list mailing list
> > > unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> > > https://www.redhat.com/mailman/listinfo/redhat-list
> >
> > --
> > redhat-list mailing list
> > unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> > https://www.redhat.com/mailman/listinfo/redhat-list
> > ==========================================================
> > For more information on the Television New Zealand Group, visit us
> > online at tvnz.co.nz
> > ==========================================================
> > CAUTION:  This e-mail and any attachment(s) contain information that
> > is intended to be read only by the named recipient(s).  This information
> > is not to be used or stored by any other person and/or organisation.
> >
> >
> > --
> > redhat-list mailing list
> > unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> > https://www.redhat.com/mailman/listinfo/redhat-list
> >
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>



-- 
-------------------------------------------------------------------------------------------------------------------------------------
NOTICE: This message, including all attachments, is intended for the use of
the individual or entity to which it is addressed and may contain
information that is privileged, confidential and exempt from disclosure
under applicable law. If the reader of this message is not the intended
recipient, or the employee or agent responsible for delivering this message
to its intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying "Received in error" and immediately delete this
message and all its attachments.
-------------------------------------------------------------------------------------------------------------------------------------
-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list



[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux