-
php tar start directory?
Have a look at this code:
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);
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?
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.
-
you might want to look here http://www.neuhaus-internet.de/cobal.../installation/ i use this for backing up my raQ servers
-
Sorry, but that doesent help. Btw, the code posted above is just a small part of the script, there's much more. All in all it's an automatic backup solution that already works, there's just the problem that if I want to move the backup to another domain or directory, than those extra directories obviously make the whole transfer a lot harder and at the end I'm looking to make this whole procedure completely automatic, so either I find out how to not include those dirs or I have to write a script that removes them for me, what I hope I don't have to do.
Fredi
-
Update: I've just run a test with relative paths, looks like that does the job.
Fredi