UBB.Dev
Posted By: Charles auto CHMOD script - 04/02/2002 2:07 AM
Hello

I am looking for a script that would CHMOD 777 all files/folders/sub folders etc. in a specified dir

do you know where I could find that ?

thanks

------------------
"If something can happen, it will" Murphy's Law
Posted By: Dave_L Re: auto CHMOD script - 04/03/2002 3:05 PM
I can think of a couple of methods.

One way would be to use the system function:
[code][/code]Another way would be to recurse the directory tree yourself and use the Perl chmod function on each file. I've done similar things before; I thought there was a Perl module which does the recursion for you, but couldn't find it.

Online Perl doc: http://perldoc.com/

Be careful doing this.
Posted By: Burak Re: auto CHMOD script - 04/04/2002 1:59 PM
enjoy!

[RIP]

look below!
Posted By: Charles Re: auto CHMOD script - 04/04/2002 8:05 PM
thanks !!
gona try it, usefull when you don't have telnet access smile
Posted By: Charles Re: auto CHMOD script - 04/07/2002 9:57 PM
doesn't go pass the main dir frown
Posted By: Burak Re: auto CHMOD script - 04/07/2002 11:35 PM
what do you mean? I didnt understand ?

btw there is a little bug in my code above: it only reads the sub dirs in the directory. does not read sub_dir/sub_sub_dir/ etc...

here is the new one, added error control when chmoding:

[code][/code]
Posted By: Burak Re: auto CHMOD script - 04/07/2002 11:38 PM
but the first one *must* read *all* files in the dir and all subdirs...
Posted By: Burak Re: auto CHMOD script - 04/09/2002 8:40 PM
so, is it working?
Posted By: Dave_L Re: auto CHMOD script - 04/10/2002 4:42 AM
jeologic, I haven't tried your script, but it appears to build an array of all the filenames (full paths), and then chmod the list. Since that could use a lot of memory (if there are a lot of subdirectories and files), do you think it would be better to chmod the files one at a time as they are found, rather than building the list?
Posted By: Burak Re: auto CHMOD script - 04/10/2002 6:27 PM
yes it builds an array of files, but also builds another array of directories...

You're right... that can be an option (chmod one by one), but this is not a multi-user thingy... so, I dont think that it will eat the memory and take the server down wink UBBDev has a lot of members as you know... A script I wrote opens & reads all this member files at once and builds "ubbdev haxxor" color files. And it does not take that long to do this in this busy site (but it takes a loooooong time in my old comp)...

A benchmark must be done to compare performance...
© UBB.Developers