function pathname, file, all = all ;+ ; ; NAME: ; PATHNAME ; ; PURPOSE: ; ; Returns pathname of directories ; containing specified files. ; Input argument - filenames with their full pathnames ; ; CATEGORY: ; File reading ; ; CALLING SEQUENCE: ; PNAME = PATHNAME(file) ; ; INPUTS: ; File name. This array may be of ASCII code. ; ; OPTIONAL INPUT PARAMETERS: ; None ; ; KEYWORD PARAMETERS: ; ALL - output all pathnames of the file set ; ; OUTPUTS: ; String array ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; None. ; ; RESTRICTIONS: ; None. ; PROCEDURE: ; Straightforward. ;- CASE strlowcase(!version.os_family) OF 'windows': Delim='\' 'unix': Delim='/' ELSE: begin message, 'Not supported on this platform.' end ENDCASE pos = rstrpos(file, Delim) N = n_elements(file) subdirs = strarr(N) for j=0, N-1 do subdirs[j] = strmid(file[j], 0, pos[j]) if not keyword_set(all) then subdirs = subdirs[uniq(subdirs, sort(subdirs))] if n_elements(subdirs) eq 1 then subdirs = subdirs[0] return, subdirs end