FILE_INFO
Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also
The FILE_INFO function returns status information about a specified file.
Syntax
Result = FILE_INFO(Path [, /NOEXPAND_PATH] )
Return Value
The FILE_INFO function returns a structure expression of type FILE_INFO containing status information about the specified file or files. The result will contain one structure for each element in the Path argument.
Fields of the FILE_INFO Structure
The FILE_INFO structure consists of the following fields:
Table 8-2: Fields of the FILE_INFO Structure
|
Field Name
|
Meaning
|
|
NAME
|
The name of the file.
|
|
EXISTS
|
True (1) if the file exists. False (0) if it does not exist.
|
|
READ
|
True (1) if the file is exists and is readable by the user. False (0) if it is not readable.
|
|
WRITE
|
True (1) if the file exists and is writable by the user. False (0) if it is not writable.
|
|
EXECUTE
|
True (1) if the file exists and is executable by the user. False (0) if it is not executable. The source of this information differs between operating systems:
UNIX: IDL checks the execute bit maintained by the operating system.
Microsoft Windows: The determination is made on the basis of the file name extension (e.g. .exe).
|
|
REGULAR
|
True (1) if the file exists and is a regular disk file and not a directory, pipe, socket, or other special file type. False (0) if it is not a regular disk file (it maybe a directory, pipe, socket, or other special file type).
|
|
DIRECTORY
|
True (1) if the file exists and is a directory. False (0) if it is not a directory.
|
|
BLOCK_SPECIAL
|
True (1) if the file exists and is a UNIX block special device. On non-UNIX operating systems, this field will always be False (0).
|
|
CHARACTER_SPECIAL
|
True (1) if the file exists and is a UNIX character special device. On non-UNIX operating systems, this field will always be False (0).
|
|
NAMED_PIPE
|
True (1) if the file exists and is a UNIX named pipe (fifo) device. On non-UNIX operating systems, this field will always be False (0).
|
|
SETGID
|
True (1) if the file exists and has its Set-Group-ID bit set. On non-UNIX operating systems, this field will always be False (0).
|
|
SETUID
|
True (1) if the file exists and has its Set-User-ID bit set. On non-UNIX operating systems, this field will always be False (0).
|
|
SOCKET
|
True (1) if the file exists and is a UNIX domain socket. On non-UNIX operating systems, this field will always be False (0).
|
|
STICKY_BIT
|
True (1) if the file exists and has its sticky bit set. On non-UNIX operating systems, this field will always be False (0).
|
|
SYMLINK
|
True (1) if the file exists and is a UNIX symbolic link. On non-UNIX operating systems, this field will always be False (0).
|
|
DANGLING_SYMLINK
|
True (1) if the file exists and is a UNIX symbolic link that points at a non-existent file. On non-UNIX operating systems, this field will always be False (0).
|
|
ATIME, CTIME, MTIME
|
The date of last access, date of file status change, and date of last modification given in seconds since 1 January 1970 UTC. Use the SYSTIME function to convert these dates into a textual representation. On Windows platforms the CTIME field will contain the file creation time. On Unix platforms the CTIME field will contain the time of the last file status change.
Note that some file systems do not maintain all of these dates (e.g. MS DOS FAT file systems), and may return 0. On some non-UNIX operating systems, access time is not maintained, and ATIME and MTIME will always return the same date.
|
|
SIZE
|
The current length of the file in bytes. If Path is not to a regular file (possibly to a directory, pipe, socket, or other special file type), the value of SIZE will not contain any useful information.
|
Arguments
Path
A string or string array containing the path or paths to the file or files about which information is required.
Note
Windows platforms have a file name length limit of 260 characters, while Unix platforms have a limit of 1024 characters. File names longer than this limit will return a structure with the EXISTS field set to zero.
Keywords
NOEXPAND_PATH
If specified, FILE_INFO uses Path exactly as specified, without applying the usual file path expansion.
Examples
To get information on the file dist.pro within the IDL User Library:
HELP,/STRUCTURE, FILE_INFO(FILEPATH('dist.pro', $
SUBDIRECTORY = 'lib'))
Executing the above command will produce output similar to:
Version History
See Also
FILE_TEST, FSTAT