|
User Documentation |
|||||||||
prev file | next file | ||||||||||
SUMMARY: fields | routine DETAILS: routine | ||||||||||
./toolbox file_exists.pro
file_exists |
function file_exists(filename[, fullname], [dir=string], [size=variable]) |
Check if a file name exists. Return 1 if it does, 0 if it doesn't. Also return the fully qualified name where the file was found.
If keyword dir is supplied then search through all of the directories in the string array dir. In this case filename should not contain a directory path.
This routine is handy to search for the location of an online datafile. They start in /share/olcor/ but get moved to /proj/projid/ directories at some later point.
NOTE: this routine will only find regular files, a directory name will return a non-existant file.
This code came from Phil Perillat at Arecibo. Local changes:
istat=file_exists('/share/olcor/corfile.13aug02.x101.1',fullname) dir=['/share/olcor/','/proj/x101cor/'] istat=file_exists('corfile.13aug02.x101.1',fullname,dir=dir)
Parameters | |
filename |
filename to search for |
fullname |
full directory/filename where file was found. : |
Keywords | |
dir |
If supplied then search through these directories. May be a vector. |
size |
If supplied then set this to the file size in bytes, if it exists. |