|
Using IDL: Getting Information About Files and Data |
|
You can use the FILE_INFO function to retrieve information about a file that is not currently open. To get information about an open file (for which there is an IDL Logical Unit Number), use the HELP procedure or the FSTAT function. See Returning Information About a File Unit.
The FILE_INFO function returns a structure expression of type FILE_INFO containing information about the file. For example, get information on dist.pro:
HELP,/STRUCTURE, FILE_INFO(FILEPATH('dist.pro',
SUBDIRECTORY='lib'))
The above command will produce output similar to:
** Structure FILE_INFO, 21 tags, length=72:
NAME STRING '/usr/local/itt/idl/lib/dist.pro'
EXISTS BYTE 1
READ BYTE 1
WRITE BYTE 0
EXECUTE BYTE 0
REGULAR BYTE 1
DIRECTORY BYTE 0
BLOCK_SPECIAL BYTE 0
CHARACTER_SPECIAL
BYTE 0
NAMED_PIPE BYTE 0
SETGID BYTE 0
SETUID BYTE 0
SOCKET BYTE 0
STICKY_BIT BYTE 0
SYMLINK BYTE 0
DANGLING_SYMLINK
BYTE 0
MODE LONG 420
ATIME LONG64 970241431
CTIME LONG64 970241595
MTIME LONG64 969980845
SIZE LONG64 1717
The fields of the FILE_INFO structure provide various information about the file, such as the size of the file, and the dates of last access, creation, and last modification. For more information on the fields of the FILE_INFO structure, see FILE_INFO. See FILE_LINES for information on how to retrieve the number of lines of text in a file.
IDL Online Help (March 06, 2007)