[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: filename check
Colley <firstname.lastname@example.org> wrote:
>Can anyone suggest a way to check that a file exists before attempting to
>read from it, since the error messages obtained from trying to read from a
>non-existing file, don't make it clear that file doesn't exist.
;; The following requires IDL 5.3 or higher...
;; if you don't have it, you'll have to figure
;; out the type yourself using the normal size
function file_exists, fileName
if( size( fileName, /type ) ne 7 ) then return, 0
fileList = findfile( fileName )
if( fileList eq '' ) then return, 0 else return, 1
end ;; file_exists