PHP is a wonderful language which make anything possible in the web world. In some applications we need to generate a archive for binding a group of files.

Tar (tape archive), a file format (in the form of a type of archive bitstream) is going to generate. The tar format was created in early days of Unix and standardised by POSIX. So better you try it in a linux based system.

$file_path is the file/directory name you would like to archive
.



code:



<? php
$output_file = "TAR_FOLDER/".trim($ file_name) .".tar";
$cmd = "tar -cf ".trim($output_ file)." -C ".trim($file_ path)."
".trim($file_ name);
exec($cmd);

?>


Category : , | Read More...... edit post

0 Response to "Generate .tar file using PHP"

Post a Comment

Followers

FeedCount

Latest Posts

thecoderinc

Subscribe Now