i try to open folder and copy files inside this folder
this code open the folder fine but not copy the file see it plz and tell me whats wrong

	

$dir=$INSTALL_PATH.trim($url);
mkdir($dir, 0777);			


$exec="cp -R ".$INSTALL_PATH."copy/* ".$INSTALL_PATH.trim($url)."/";
exec($exec);

$exec="chmod -R a+Xrw ".$INSTALL_PATH.trim($url)."/";
exec($exec);




    Try using copy() instead, so you'll get the PHP error, rather than what it might give you using exec().

      copy($INSTALL_PATH."copy/".$file,$dir);, where $file is a single file. You'll have to loop through every file in the directory:

      $dir = opendir($INSTALL_PATH."copy/");
      while ($file = readdir($dir)) {
        copy($INSTALL_PATH."copy/".$file,$dir);
      }
      closedir($dir);

        it not give me any error it just open the folder right but it not copy the file from the folder (copy) to the folder i made

          What is $INSTALL_PATH? That might be where the problem lies.

            i defind this before for the place in the server i want to open the folder

              Try using copy() or die() to see if it's erroring out.

                what im sure about is the wrong in these 2 lines

                $exec="cp -R ".$INSTALL_PATH."copy/* ".$INSTALL_PATH.trim($url)."/";
                exec($exec);

                where $INSTALL_PATH is = www/mysite/html/

                and i want to copy files from this folder

                www/mysite/html/copy

                to this file

                www/mysite/html/the_new_folder

                and trim($url) is = the_new_folder

                  Write a Reply...