Archive_Tar::add()

Archive_Tar::add() – add files or directories

Synopsis

require_once 'Archive/Tar.php';

boolean add ( mixed $filelist )

Description

This method adds files and directories to an existing archive. If the archive does not exist, it attempts to create it. The files and directories listed are added at the end of the archive, even if a file with the same name is already archived.

Parameter

  • mixed $filelist - an array of filenames and directory names, or a single string with names separated by a single blank space. For each directory added in the archive, the files and sub-directories are also added.

Return value

boolean - Returns TRUE on success, FALSE on failure.

Throws

Possible PEAR_Error values
Error code Error message Reason Solution
NULL "Invalid file list" The argument for the function is not correct formatted or build. Check for typing mistakes in the argument

Note

This function can not be called statically.

Example

Add files to a compressed archive

<?php
$tar_object 
= new Archive_Tar("tarname.tar.gz"true);
$v_list[0]="dev/file.txt";
$v_list[1]="dev/data/";
$v_list[2]="log/file.log";
$tar_object->add($v_list);
?>
constructor (Previous) add files or directories (Next)
Last updated: Fri, 21 Nov 2014 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.