Page 1 of 1
How do I chmod a directory and all files in it???
Posted: Thu Apr 27, 2006 8:56 pm
by Maluendaster
How do I chmod a directory and all files in it??
For example, I want to chmod de dir images, and all files in it, and also i want to chmod the dir logs and all files in it... and also, that the script tells me if it was chmoded or not....
thank you...
PD : I looked
http://cl.php.net/chmod , and i didn't find the code I need.....
Posted: Thu Apr 27, 2006 11:33 pm
by feyd
build a file and directory list, run said list through chmod one-by-one.
Posted: Thu Apr 27, 2006 11:41 pm
by Maluendaster
i don't understand you, please keep in mind that i'm into PHP for a very short time....

Posted: Thu Apr 27, 2006 11:43 pm
by feyd
- build an array containing all the file names and directory names you want to chmod. opendir()-readdir() and glob() can help here.
- use a loop control to iterate over this array calling chmod for each and every entry you've created.
Posted: Thu Apr 27, 2006 11:47 pm
by Maluendaster
feyd wrote:- build an array containing all the file names and directory names you want to chmod. opendir()-readdir() and glob() can help here.
- use a loop control to iterate over this array calling chmod for each and every entry you've created.
thanks, i'm gonna try that and see if i can make it work....
Posted: Fri Apr 28, 2006 1:00 am
by Benjamin
Ok just some FYI, and I am sorry I don't have time to look this up, but there are *ix commands that can be run from a shell that will recursivly apply chmod permissions respective of folders vs files. Might want to search on google for a while.
Posted: Fri Apr 28, 2006 10:30 am
by Maluendaster
agtlewis wrote:Ok just some FYI, and I am sorry I don't have time to look this up, but there are *ix commands that can be run from a shell that will recursivly apply chmod permissions respective of folders vs files. Might want to search on google for a while.
yeah i know, but what i want to do, is a scritp that automaticly chmod the dirs and files (like setup.php or something), because i need to install this script several times...
Posted: Fri Apr 28, 2006 10:44 am
by themurph
from php:
----------------------------------------
http://us3.php.net/chmod
Specifically, look at the post from 27-Nov-2004 01:09 in the user comments section.
from *nix prompt:
----------------------------------------
chmod -R [permissions] /path/to/directory
google for "chmod man page" for more info
Posted: Fri Apr 28, 2006 3:09 pm
by Maluendaster
themurph wrote:from php:
----------------------------------------
http://us3.php.net/chmod
Specifically, look at the post from 27-Nov-2004 01:09 in the user comments section.
from *nix prompt:
----------------------------------------
chmod -R [permissions] /path/to/directory
google for "chmod man page" for more info
thank you