Hi this is the program I am using to list all folders and subfolders, (inserting the list to mysql database -NOT IMPORTANT IN THIS CASE)...
What I want and what the problem is ,that as I am listing these folders I want to change their permissions ONE BY ONE to chmod 0777 ... please can someone figure out how to do this? I am spending lots of time ,getting nowhere...
pls
joe jarosciak
program:
function listOfDirs($start, $depth = 0)
{
GLOBAL $db;
$start2 = $start;
//recursivly lists subdirs.
$start = realpath($start);
$handle = opendir($start);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if(is_dir($start."/".$file))
{
$x = 0;
while($x < $depth){
// echo " ";
$x++;
}
echo "<b>".$start2."/".$file." </b><br>";
listOfDirs($start2."/".$file, $depth + 1);
$vysledo= $start2."/".$file;
$vysledok= eregi_replace("albums/","",$vysledo) ;
if ($file <> "jj_scratch") {
$sql7 = "INSERT INTO jj_folders (jj_foldpath,jj_foldepth) VALUES ('$vysledok','$depth')";
$result7 = mysql_query($sql7, $db);
}
}}}
closedir($handle);
}
listOfDirs('albums');
?>
How should I chmod all folders and subfolders to chmod 777 ???