gorilla1
10-22-2002, 08:29 PM
I am trying to write a routine that will create a target directory and then copy all the files from a specific root directory to that newly created target directory. Under "copy" in the php manual some folks describe a few ways to do this. But when I try it on a server, I run into all kinds of permissions problems. If I do the steps of creating a new folder and copy pasting under ftp, no problem. But using php code (and just using a directory already created and working under ftp in order to simplify and avoid any question of whether the mkdir is the issue) on the first file copy I get a permission denied error. So I added chmod ($dirt, 0666); to ensure the directory is writable, but I still get: "Unable to create 'xxx.xxx': Permission denied " How do I get this off the ground?... Elsewhere in the notes under the copy command, some one writes the following:
For you unix users copying a directory is as easy as this
(back ticks)
`cp -R <directory name> <new name>`
This would certainly simplify things. But I had no luck with this either when I coded it as: $exc = `cp -R <directory name> <new name>` For reference, below is the code I ran that gets the permission problems.
G
$dirt = "ITODAY2";
$root = "ITODAY";
$file = "VIX.gif";
chmod ($dirt, 0666);
copy($root."/".$file,$dirt."/".$file);
For you unix users copying a directory is as easy as this
(back ticks)
`cp -R <directory name> <new name>`
This would certainly simplify things. But I had no luck with this either when I coded it as: $exc = `cp -R <directory name> <new name>` For reference, below is the code I ran that gets the permission problems.
G
$dirt = "ITODAY2";
$root = "ITODAY";
$file = "VIX.gif";
chmod ($dirt, 0666);
copy($root."/".$file,$dirt."/".$file);