WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0
Add the ending header to a TAR file
This function will attempt to add the ending header to a previously opened file in TAR format1). To use this function, first open the file using fopen(), then call tar_put() as many times as needed to add individual files. When finished adding files call this function to add the ending header and close the file (releasing the handle).
$handle: Valid handle of the already opened file. This is obtained from the previous call to fopen() specifying 'w' for write mode.
Integer: 1 if successful, or 0 if the attempt to finish the TAR failed
<? $handle=fopen("/tar_put_example.tar",'w'); // open TAR for writing $path="/config/"; chdir($path); $aFile=findfirst("*.*",255-16); // get the first file, excluding directories while ($aFile) { tar_put($handle,$path.$aFile['filename'],$aFile['filename']); $aFile=findnext(); // get the next file } // loop until no more files tar_finish($handle); // finish and close the TAR ?>
fopen() - Open a file for reading or writing
tar_put() - Add a file to an open file in TAR format
chdir() - Change the current directory
findfirst() - Start searching the current folder for files matching a pattern and attributes
findnext() - Return next matching file information (after a findfirst)
untar() - Expand a TAR file into the current folder, optionally verbose