Monday, November 7, 2011

IDL test if directory exists

To test if a directory exists (prior to creating it) using IDL, the FILE_TEST command has a special parameter just for that:

result = FILE_TEST (,/DIRECTORY)

See here:

http://idlastro.gsfc.nasa.gov/idl_html_help/FILE_TEST.html

Look at this nightmarish way this person did it:

http://www.astro.washington.edu/docs/idl/cgi-bin/getpro/library27.html?DIR_EXIST

Another very difficult way to do this would have been to use FILE_INFO:

http://idlastro.gsfc.nasa.gov/idl_html_help/FILE_INFO.html