copy files in Server..................
Posted: Sat May 20, 2006 1:41 am
hi please reply to my problem As Soon As Posible................
problem:
----------
source directory:pdf/2006/05/16
target directory:test/2006/05/16
now problem is it is not copying from source directory to target directory.
i gave all permissions to all folders as 0777.
please see the code and reply what is the wrong in my code As Soon As Posible................
CODE:
-------
<?
ini_set("max_execution_time", 0);
chmod("test", 0777);
chmod("test/2006", 0777); //permissions
chmod("test/2006/05", 0777);
chmod("test/2006/05/16", 0777);
$page="20060516";
$sfilepath = "pdf";
$year = substr($page,0,4);
$month = substr($page,4,2);
$day = substr($page,6,2);
$dirpath = $sfilepath.'/'.$year.'/'.$month.'/'.$day; //source directory
$sourcedir = @opendir($dirpath);
$tfilepath="test";
$target=$tfilepath.'/'.$year.'/'.$month.'/'.$day; //target directory
$targetdir = @opendir($target);
while(!is_bool($filename = @readdir($sourcedir)))
{
if($filename != '.' && $filename != '..')
{
$sfile = $dirpath.'/'.$filename;
$tfile = $target.'/'.$filename;
@copy($sfile,$tfile); //copy from source to target
}
}
?>
Waiting for your valuable replies..............
Thanks and regards
madhu
problem:
----------
source directory:pdf/2006/05/16
target directory:test/2006/05/16
now problem is it is not copying from source directory to target directory.
i gave all permissions to all folders as 0777.
please see the code and reply what is the wrong in my code As Soon As Posible................
CODE:
-------
<?
ini_set("max_execution_time", 0);
chmod("test", 0777);
chmod("test/2006", 0777); //permissions
chmod("test/2006/05", 0777);
chmod("test/2006/05/16", 0777);
$page="20060516";
$sfilepath = "pdf";
$year = substr($page,0,4);
$month = substr($page,4,2);
$day = substr($page,6,2);
$dirpath = $sfilepath.'/'.$year.'/'.$month.'/'.$day; //source directory
$sourcedir = @opendir($dirpath);
$tfilepath="test";
$target=$tfilepath.'/'.$year.'/'.$month.'/'.$day; //target directory
$targetdir = @opendir($target);
while(!is_bool($filename = @readdir($sourcedir)))
{
if($filename != '.' && $filename != '..')
{
$sfile = $dirpath.'/'.$filename;
$tfile = $target.'/'.$filename;
@copy($sfile,$tfile); //copy from source to target
}
}
?>
Waiting for your valuable replies..............
Thanks and regards
madhu