The FILE_TEST function checks files for existence and other attributes without having to first open the file.
Result = FILE_TEST( File [, /DIRECTORY | , /EXECUTABLE | , /READ | , /REGULAR | , /WRITE | , /ZERO_LENGTH] [, GET_MODE=variable] [, /NOEXPAND_PATH] )
UNIX-Only Keywords: [, /BLOCK_SPECIAL | , /CHARACTER_SPECIAL | , /DANGLING_SYMLINK | , /GROUP | , /NAMED_PIPE | , /SETGID | , /SETUID | , /SOCKET | , /STICKY_BIT | , /SYMLINK | , /USER]
FILE_TEST returns 1 (true), if the specified file exists and all of the attributes specified by the keywords are also true. If no keywords are present, a simple test for existence is performed. If the file does not exist or one of the specified attributes is not true, then FILE_TEST returns 0 (false).
A scalar or array of file names to be tested. The result is of type integer with the same number of elements as File.
Set this keyword to return 1 (true) if File exists and is a block special device.
Set this keyword to return 1 (true) if File exists and is a character special device.
Set this keyword to return 1 (true) if File is a symbolic link that points at a non-existent file.
Set this keyword to return 1 (true) if File exists and is a directory.
Set this keyword to return 1 (true) if File exists and is executable. The source of this information differs between operating systems:
Set this keyword to a named variable to receive the UNIX style mode (permission) mask for the specified file. The bits in these masks correspond to those used by the UNIX chmod(2) system call, and are explained in detail in the description of the Mode argument to the FILE_CHMOD procedure. When interpreting the value returned by this keyword, the following platform specific details should be kept in mind:
chmod(2) man page and/or other UNIX programming documentation for more details.Set this keyword to return 1 (true) if File exists and belongs to the same effective group ID (GID) as the IDL process.
Set this keyword to return 1 (true) if File exists and is a named pipe (fifo) device.
Set this keyword to cause FILE_TEST to use the File argument exactly as specified, without applying the usual file path expansion.
Set this keyword to return 1 (true) if File exists and is readable by the user.
Set this keyword to return 1 (true) if File exists and is a regular disk file and not a directory, pipe, socket, or other special file type.
Set this keyword to return 1 (true) if File exists and has its Set-Group-ID bit set.
Set this keyword to return 1 (true) if File exists and has its Set-User-ID bit set.
Set this keyword to return 1 (true) if File exists and is a UNIX domain socket.
Set this keyword to return 1 (true) if File exists and has its sticky bit set.
Set this keyword to return 1 (true) if File exists and is a symbolic link that points at an existing file.
Set this keyword to return 1 (true) if File exists and belongs to the same effective user ID (UID) as the IDL process.
Set this keyword to return 1 (true) if File exists and is writable by the user.
Set this keyword to return 1 (true) if File exists and has zero length.
| Note |
Does my IDL distribution support the IRIX operating system?
result = FILE_TEST(!DIR +'/bin/bin.sgi', /DIRECTORY) PRINT,'IRIX IDL Installed:', result ?'yes':'no'
Introduced: 5.4