This methods add files and directories listed in
filelist at the end of the existing archive.
If the archive does not exists it attempts to create it.
If a file or directory is already in the archive it will only be added
at the end of the archive. There is no update of the existing archived
file or directory. However while extracting the archive, the last file will
replace the first one. This results in a none optimization of the
archive size. If a file or directory does not exists, it is ignored.
Parameter
mixed $filelist -
an array of filenames and directory
names, or a single string with names separated by a single blank space.
string $add_dir -
a string which contains a path to be
added to the memorized path of each element in the list.
string $remove_dir -
a string which contains a path to be
removed from the memorized path of each element in the list, when
relevant.
The path indicated in add_dir will be added
at the beginning of the memorized path of each file/directory
listed. However it can be set to empty ''. The adding of a
path is done after the removing of path. The path
add/remove ability enables the user to prepare an archive
for extraction in a different path than the original path.
Return value
boolean - Returns TRUE on success, FALSE on failure.
$tar_object = new Archive_Tar("tarname.tar");
$v_list[0]="dev/file.txt";
$v_list[1]="dev/data/";
$v_list[2]="log/file.log";
$tar_object->addModify($v_list, "install");
// files are stored in the archive as :
// install/file.txt
// install/data
// install/data/file1.txt
// install/data/... all the files and sub-dirs of data/
// install/file.log
$tar_object = new Archive_Tar("tarname.tar");
$v_list[0]="dev/file.txt";
$v_list[1]="dev/data/";
$v_list[2]="log/file.log";
$tar_object->addModify($v_list, "install", "dev");
// files are stored in the archive as :
// install/file.txt
// install/data
// install/data/file1.txt
// install/data/... all the files and sub-dirs of data/
// install/log/file.log
$tar_object = new Archive_Tar("tarname.tar");
$v_list[0]="d:\\dev\\file.txt";
$v_list[1]="d:\\dev\\data\\";
$v_list[2]="d:\\log\\file.log";
$tar_object->addModify($v_list, "install/temp", "d:\\dev");
// files are stored in the archive as :
// install/temp/file.txt
// install/temp/data
// install/temp/data/file1.txt
// install/temp/data/... all the files and sub-dirs of data/
// install/temp/log/file.log
On Windows system, Windows path format can be used.
However if the files are using a Windows path,
the $remove_dir parameter must also be
in Windows path format.
The $add_dir parameter can be in
Windows or Unix path format.