RE: Argument List too Long



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



Relevant Pages

  • Re: Command line to remove duplicate files?
    ... Ohmster wrote: ... what xargs does? ... So what xargs does is pretty much pass on large numbers to the command ... Put "messageforohmster" in message body ...
    (alt.os.linux)
  • Re: some basic command line stuff
    ... The xargs program reads input in order to build up a command to ... which the shell will split on. ... ++ echo 19/P6211874.JPG ...
    (comp.unix.programmer)
  • Re: Pipe output from find to mv
    ... I would suggest you to go with gnu xargs instead of -exec ... At first glance, the find command above was rather complicated, not to ... though- GNU find and everyone else's. ... we must use another command to sort such output-a ...
    (comp.unix.shell)
  • Re: Neophyte: ls with wildcards
    ... There's two ways to provide data for a command -- either as a command ... What xargs does is it reads data from standard input and then looks ... would lead to xargs eventually executing "ls /bin". ... to argument lists ...
    (comp.unix.shell)
  • Re: find -exec surprisingly slow
    ... deleting files from a directory which has 400K filenames in it, ... mv usermail usermail.bigspam ... The thing to use is the '-J' option of xargs. ... a single `mv' command as possible. ...
    (freebsd-questions)