Return to Snippet

Revision: 19770
at January 19, 2010 04:04 by ginoplusio


Updated Code
// recursively chmod files to 644 and directories to 755
function rchmod($dir) {
	foreach (glob("$dir/*") as $child) { 
		chmod($child, (is_dir($child)? rchmod($child): 0644)); 
	}
	return 0755;
}

// example on dir "db-images":
rchmod("./db-images");

Revision: 19769
at October 30, 2009 09:48 by ginoplusio


Initial Code
// recursively chmod files to 644 and directories to 755
function rchmod($dir) {
	foreach (glob("$dir/*") as $child) { 
		chmod($child, (is_dir($child)? rchmod($child): 0644)); 
	}
	return 0755;
}

// call the function on the current directory
rchmod(".");

Initial URL
http://www.barattalo.it/2010/01/19/recursive-chmod-on-files-and-directory/

Initial Description
recursively chmod files to 644 and directories to 755

Initial Title
Recursive chmod

Initial Tags

                                

Initial Language
PHP