|
Joined: Oct 2000
Posts: 2,667
Veteran
|
Veteran
Joined: Oct 2000
Posts: 2,667 |
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
Do you believe in love at first sight, or should I walk by again?
|
|
|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
Joined: Aug 2000
Posts: 335 |
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.
|
|
|
|
Joined: May 2000
Posts: 1,356
Addict
|
Addict
Joined: May 2000
Posts: 1,356 |
|
|
|
|
Joined: Oct 2000
Posts: 2,667
Veteran
|
Veteran
Joined: Oct 2000
Posts: 2,667 |
thanks !! gona try it, usefull when you don't have telnet access
Do you believe in love at first sight, or should I walk by again?
|
|
|
|
Joined: Oct 2000
Posts: 2,667
Veteran
|
Veteran
Joined: Oct 2000
Posts: 2,667 |
doesn't go pass the main dir
Do you believe in love at first sight, or should I walk by again?
|
|
|
|
Joined: May 2000
Posts: 1,356
Addict
|
Addict
Joined: May 2000
Posts: 1,356 |
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]
|
|
|
|
Joined: May 2000
Posts: 1,356
Addict
|
Addict
Joined: May 2000
Posts: 1,356 |
but the first one *must* read *all* files in the dir and all subdirs...
|
|
|
|
Joined: May 2000
Posts: 1,356
Addict
|
Addict
Joined: May 2000
Posts: 1,356 |
|
|
|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
Joined: Aug 2000
Posts: 335 |
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?
|
|
|
|
Joined: May 2000
Posts: 1,356
Addict
|
Addict
Joined: May 2000
Posts: 1,356 |
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 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...
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 69
Joined: January 2001
|
|
Forums63
Topics37,573
Posts293,925
Members13,849
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|