How do I chmod a directory and all files in it???
Moderator: General Moderators
-
Maluendaster
- Forum Contributor
- Posts: 124
- Joined: Fri Feb 25, 2005 1:14 pm
How do I chmod a directory and all files in it???
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.....
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.....
-
Maluendaster
- Forum Contributor
- Posts: 124
- Joined: Fri Feb 25, 2005 1:14 pm
-
Maluendaster
- Forum Contributor
- Posts: 124
- Joined: Fri Feb 25, 2005 1:14 pm
thanks, i'm gonna try that and see if i can make it work....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.
-
Maluendaster
- Forum Contributor
- Posts: 124
- Joined: Fri Feb 25, 2005 1:14 pm
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...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.
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
----------------------------------------
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
-
Maluendaster
- Forum Contributor
- Posts: 124
- Joined: Fri Feb 25, 2005 1:14 pm
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