Hi all Thanks for the replies. This sounds like a good topic for an FAQ. There's one more way that occurs to me, the TEST_OPENDAP function. It returns the flag that's sent back from the netCDF library on a request to open the dataset. If the flag is zero, the file exists and can be correctly opened. yes? list test_opendap("z_wide_variation.nc")If the file exists but is not a valid netCDF file or opendap url, you get various other codes depending on the error (invalid remote url, not-a-nc file, etc.) If the file does not exist, you 'll get -2. yes? list test_opendap("this_file_doesnt_exist.nc") So you could test for the result of the function being zero. Ansley On 10/25/2011 2:19 AM, Ryo Furue wrote: Hi Dan, | I would like to check file existence before saving it. | You can use shell commands for that: let ret = {spawn:"[ -e CTL.nc ]; echo $?"} if `ret[i=1] eq "0"` then ! . . . file exists . . . else ! . . . file does not exist . . . endif The shell command "[ -e file ]" returns 0 if the file exists or a different value if it does not. The command "echo $?" just prints the return value of the preceding command to the standard output. The SPAWN _expression_ of Ferret catches the standard output of the shell command(s). There may be a Ferret-proper way. Regards, Ryo |