On Mon, 2007-03-19 at 11:16 -0600, Eduardo Sanz-Garcia wrote:
> Today I have tried to remove 3500 files at once using the argument 
> expantion of bash: "rm *.txt"
> There was an error:
> *bash: /bin/mv: Argument list too long
> *Here is the explanation and the workaround:

When using xargs, it is critical to remember that xargs might run your
command multiple times. For example, here's a classic newbie mistake:

find -mtime -7 | xargs tar cvfz backup.tgz

Remembering that the tar command might actually run multiple times, one
should instead do something like:

rm backup.tgz ; touch backup.tgz
find -mtime -7 | xargs tar rvfz backup.tgz

-- 
Stuart Jansen              e-mail/jabber: [EMAIL PROTECTED]
                           google talk:   [EMAIL PROTECTED]

"However beautiful the strategy, you should occasionally look at 
the results." -- Winston Churchill

Attachment: signature.asc
Description: This is a digitally signed message part

--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to