A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: php tar start directory?

  1. #1
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779

    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.
    Mind Share Projects [ <- my latest projects ] [ my splash page -> ] Fredi Bach
    OS X Code (r,s) [ my Mac, web 2.0 and programming blog ]
    Not A Blog [ my personal weblog ]
    jMe Feed Aggregator [ my latest most famous project ]
    Web Command Line [ use the web like a real geek ]

  2. #2
    flashcom addict
    Join Date
    Feb 2006
    Posts
    45
    you might want to look here http://www.neuhaus-internet.de/cobal.../installation/ i use this for backing up my raQ servers
    FCS , FMS , Red5 and Wowza application demos online
    see our 18 streaming cameras (including 6 wireless IP cameras)
    8 networked computers some running Windows xp pro others running Linux Centos,The main website running on Sun Colbalt RaQ550 with 1.5 gig of ram using strongbolt software and the latest Centos OS

  3. #3
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779
    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
    Mind Share Projects [ <- my latest projects ] [ my splash page -> ] Fredi Bach
    OS X Code (r,s) [ my Mac, web 2.0 and programming blog ]
    Not A Blog [ my personal weblog ]
    jMe Feed Aggregator [ my latest most famous project ]
    Web Command Line [ use the web like a real geek ]

  4. #4
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779
    Update: I've just run a test with relative paths, looks like that does the job.

    Fredi
    Mind Share Projects [ <- my latest projects ] [ my splash page -> ] Fredi Bach
    OS X Code (r,s) [ my Mac, web 2.0 and programming blog ]
    Not A Blog [ my personal weblog ]
    jMe Feed Aggregator [ my latest most famous project ]
    Web Command Line [ use the web like a real geek ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center