Have a look at this code:
Basically this creates a tar of my uploads and flatdb folders with all it's subdirs and contents. Now the problem is that it creates a tar with the whole directory structure in it, like 'www/mydomain.com/httpdocs/uploads/'. How can I change this behavior so that it doesent add all those additional directories below 'httpdocs'? Any ideas?PHP Code:$backupdir = substr(getcwd(),0,strlen(getcwd())-$pathcut).'/backups';
$uploaddir = substr(getcwd(),0,strlen(getcwd())-$pathcut).'/uploads';
$flatdbdir = substr(getcwd(),0,strlen(getcwd())-$pathcut).'/flatdb';
$now = time();
$data_archive = $backupdir.'/databackup.'.date('d_m_y',$now).'.'.$now.'.tar.gz';
$result = exec('tar zcf '.$data_archive.' '.$uploaddir.' '.$flatdbdir);
Fredi
PS: That whole thing with the $pathcut variable is there so I can use the real paths of files and folders when including the files from different locations.




Reply With Quote