----- Original Message -----
From: "Ricardo Gomez"
2008/11/24 Carlos E. R.
: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Monday, 2008-11-24 at 12:52 -0600, David C. Rankin wrote:
I was trying to use chmod, but it says:
12:44 nirvana/srv/www/download> find . -type f -print0 | xargs -0 sudo chmod 0644 sudo: unable to execute /bin/chmod: Argument list too long
It's simple, just modify your command to :
sudo find . -type f -exec chmod 0644 {} \; -print
That's hardly any better. xargs is the correct tool for this job just as he originally tried. The very definition of xarg's job is to collect input into chunks that are as big as the shell can handle, but no bigger. It's whole point is to coalesce commands as much as the shell and the kernel will allow, because iterating through huge lists one file or one item at a time (as above, using find alone) is slow and inefficient a lot of times. It's true that some versions of find do, or can coalesce the arguments sort of like having xargs built-in, but that is the exception not the rule and shouldn't be relied on. His original command , of the form "find |xargs" was already the ideal. The only thing I can think of is perhaps the sudo screws it up somehow. What the original command was really running was several big sudo commands, where really it's more expected to run several big chmod or other direct commands. (who wants to answer sudo password prompt 50 times?) sudo also just does a lot of funky stuff with the child environment in general and something like this result doesn't really surprise me. I would try: su - find |xargs chmod Also, there are options to reduce the buffer size xargs will assemble. find |xargs -s 32767 According to man xargs, the default size it will assemble is 131k, so 32k should be plenty safe and yet still make large enough command lines to chew through the job fast. Ovbviously you can play with the -s size and find where exactly it stops working and find the largest working value. -- Brian K. White brian@aljex.com http://www.myspace.com/KEYofR +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++. filePro BBx Linux SCO FreeBSD #callahans Satriani Filk! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org