Hello all,
I'm coding a blog and I have a script that copys a directory. It works fine, but the newly copied dir's permissions are auto set to "0655". So I cant delete it or modify it. I have to get the system admin to do that. So if someone knows how to set it to chmod to 755, instead of 655 that would be great.
P.S. Ive already tried writing a script that attempts to chmod it after its created. (after the script is done) but I get permission errors. Here is the code:
PHP Code:
<?php $source= "source"; $dest = "newblog";
function COPY_RECURSIVE_DIRS($dirsource, $dirdest) {
global $source; if(is_dir($dirsource))$dir_handle=opendir($dirsource);
// creates the directory if it doesn't exist
if(!is_dir("$source/$dirdest/")) { echo "i am here :D"; mkdir("$dirdest/", 0777); }
while($file=readdir($dir_handle)) { if($file!="." && $file!="..") { if(!is_dir("$dirsource/$file")) {
copy ("$dirsource/$file", "$source/$file");
} else COPY_RECURSIVE_DIRS("$dirsource/$file", "$dirdest"); } } closedir($dir_handle); return true; }
COPY_RECURSIVE_DIRS("$source","$dest"); ?>
thanks
Last edited by lerch; 12-20-2005 at 04:42 PM..
|