Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


FILE_TAR

FILE_TAR

The FILE_TAR procedure archives a given set of input files and directories into a TAR file or an output buffer.

This routine is written in the IDL language. Its source code can be found in the file file_tar.pro in the lib subdirectory of the IDL distribution.

Examples


This example archives the resource/fonts subdirectory within the IDL installation, and saves the TAR file to our current working directory:

dir = FILEPATH('', SUBDIR=['resource','fonts'])
FILE_TAR, dir, 'idlresources.tar', /VERBOSE

IDL prints:

% C:\Program Files\Harris\IDLxx\resource\fonts\
% C:\Program Files\Harris\IDLxx\resource\fonts\hersh1.chr, 97718 bytes
...
% C:\Program Files\Harris\IDLxx\resource\fonts\tt\ttfont.map, 957 bytes
% Total 61 files, 2066629 bytes
% Time elapsed: 0.55800009 seconds.

As another example, we can archive a set of files to a buffer, potentially send the buffer to a different IDL process, and then expand the buffer.

dir = FILEPATH('', SUBDIR=['resource','fonts'])
FILE_TAR, dir, BUFFER=buffer, /GZIP
HELP, buffer
; ...send the buffer somewhere else, then untar it...
FILE_UNTAR, buffer, 'idlresources', /VERBOSE

IDL prints:

BUFFER          BYTE      = Array[923103]
 
% fonts/
% fonts/hersh1.chr, 97718 bytes
% fonts/tt/ttfont.map, 957 bytes
...
% Total 61 files, 2066629 bytes
% Time elapsed: 0.36199999 seconds.

Syntax


FILE_TAR, Files [, FileOut] [, BUFFER=variable] [, FILES=variable] [, /GZIP] [, /LIST] [, /VERBOSE]

Arguments


Files

Set this argument to a string or array of strings giving the directories and files to add to the TAR file. Directories will be recursively searched, and all subdirectories and files within those directories will be added to the TAR file.

FileOut

Set this optional argument to a scalar string giving the output filename. If FileOut is not provided then FILE_TAR will construct the output filename by taking the first entry in Files and appending the file suffix ".tar" to the name.

Keywords


BUFFER

Setting this keyword to a named variable causes IDL to store the TAR data as a byte array within the variable rather than within a file. If this keyword is present, do not provide the FileOut argument.

FILES

Set this keyword to a named variable. On return, this variable will contain a string array of all of the directories and files added to the TAR file.

GZIP

Set this keyword to automatically compress the resulting TAR file using GZIP compression. In this case, if FileOut is not provided, the output filename will have the file suffix ".tar.gz".

LIST

Set this keyword to perform all of the FILE_TAR actions without actually creating a TAR file or buffer. The list of files can be retrieved using the FILES keyword, while the VERBOSE keyword will output the names of the directories and files that would have been added to the TAR file. If LIST is set then the BUFFER and GZIP keywords are ignored.

VERBOSE

Set this keyword to output additional information while the routine is executing.

Version History


8.2.3

Introduced

See Also


FILE_UNTAR, FILE_GZIP, FILE_GUNZIP, FILE_ZIP, FILE_UNZIP, ZLIB_COMPRESS, ZLIB_UNCOMPRESS



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us