chmod for great number of files

Hi all,

I have a script who generate as an output a lot of files (the number is highly variable : 500 to more than 10000).
At the end of this script I need to do a "chmod" on all those files. I tried [CODEchmod 777 *][/CODE]
but it says

-bash: /bin/chmod: Argument list too long

So it seems that chmod can't perform on large amount of files. So does anyone knows how I could do that?

Regards

Hi.

AIX?

You best do a recursive chmod on the whole directory

chmod -R 700 /tmp/example

Another way, instead of

chmod 777 *

try

echo * | xargs chmod 777

Jean-Pierre.

thanks a lot Jean-Pierre, you save my life! :D:b:
And maybe you could save me a 2nd time if you say me hox to remove all those files...
I tried

rm *

but it always says "argument list too long"....

Regards

if "chmod" works with xargs, why not "rm"?

i.e.

echo * | xargs rm

well, in this case, the shell will says that there is too few arguments for "rm"

There is no problem to use this technique for the rm command :

$ ls
file_1.txt  file_2.txt  file_3.txt  file_4.txt  file_5.txt
$ echo * | xargs rm
$ ls
$ 

jean-Pierre.

Ok, I think I need to apologize... Indeed it works. I must have written something bad when i tried it..

Thanks anyway!

try this...it works in AIX..

ls | xargs rm