using tar from php

A

Anonymous

Guest
should i use this code to put into a tar the content of a folder?(files,subfolders,files in subfolders,etc)

Code:
<?php 
$comanda=shell_exec('$ tar --create --file=backup.tar *');   
if ($comanda == 1){ 
print "click 2 download. <a href='backup.tar'>backup</a>"; 
} 
?>

or instead of '*' i should use '.' ?
anyway...is this logic?
doesnt work for me.
 
As far as im concerned -- you should check the manual for $tar command...

try "man tar" and look at the manual of the tar command...
Sorry that i cant give you any more information, but i simply dont remember a thing of linux right now and dont have access to a linux machine right now..
 
xilviu said:
should i use this code to put into a tar the content of a folder?(files,subfolders,files in subfolders,etc)

Code:
<?php 
$comanda=shell_exec('$ tar --create --file=backup.tar *');   
if ($comanda == 1){ 
print "click 2 download. <a href='backup.tar'>backup</a>"; 
} 
?>

or instead of '*' i should use '.' ?
anyway...is this logic?
doesnt work for me.

try this
Code:
$comanda=shell_exec('tar -zcvf filename.tar.gz filename');
 
Back
Top