Hans - don't giggle. :)

On Mar 19, 2007, at 11:16 AM, 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:


>> However, it is one that is easily worked around
>> using the supplied utilities.  Please review the documentation on  
>> 'find'
>> and 'xargs' for one possible combination of programs that work well.
>>
>> Here is an example using chmod where exceeding ARG_MAX argument  
>> length
>> is avoided.
>>
>>   find htdocs -name '*.html' -print0 | xargs -0 chmod a+r


There is one thing to note here:

Using alternative methods to delete or alter large lists of items can  
result in VERY undesirable results if you have spaces in your  
pathnames.  i.e:

find -name ".svn" . | xargs rm -rf

What I MEANT to do was to prune out all the .svn directories from a  
source tree.  What HAPPENED is that it deleted the whole source tree  
because of a space in my path.

Just something to keep in mind.

-- Kimball 




--------------------
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