function rsl_basename, file, suffix ; Returns the file name with path removed. Based on the UNIX command. ; ; Syntax: ; result = rsl_basename(file [, suffix]) ; ; Inputs: ; file: file name. ; suffix: string specifying part of file name to be removed. ; ; Written by: Bart Kelley, GMU, August 2004 ;*************************************************************************** basefile = file ; This could have been done more simply using the new strpos keyword /REVERSE, ; or using the old routine rstrpos (now obsolete), but I wanted backward ; compatability without using an obsolete routine. lastpos = -1 pos = strpos(file,'/') while pos gt -1 do begin lastpos = pos pos = strpos(file,'/',pos+1) endwhile basefile = strmid(file,lastpos+1) if n_params() eq 2 then begin suflen = strlen(suffix) pos = strpos(basefile,suffix,strlen(basefile)-suflen) if pos gt -1 then basefile = strmid(basefile,0,pos) endif return, basefile end