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.
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.
Table 44-1. Possible PEAR_Error values
|Error code||Error message||Reason||Solution|
|NULL||"Invalid file list"||The argument for the function is not correctly formatted or build.||Check for typing mistakes in the argument|
|NULL||"Unable to open in write mode file name"||The file permissions for an existing file do not allow writing or the file is locked.||Check permissions and possible competive programs using the file.|
|NULL||"Invalid file list"||Archive is empty or corrupted|
|NULL||"File filename does not exist"||A file you want to add to the archive does not exist.||Check for typing mistakes in the function argument.|
|NULL||"Directory dirname can not be read"||A directory or a file in it you want to add to the archive does not exists or the permissions for reading the directory does not allow access.||Check for typing mistakes in the function argument and permissions.|
|NULL||"Unable to open file filenamein binary read mode"||The file to add to the archive could not be read.||Check for typing mistakes in the function argument and file permissions.|
Example 44-1. Add files to a compressed archive in a new directory
Example 44-2. Add files to a compressed archive moving to a new directory
Example 44-3. Add files to a compressed archive moving to a new directory (especially for Windows)
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.