;+
;PROCEDURE  FILE_MKDIR2, dir
;PURPOSE:  Wrapper for FILE_MKDIR that also sets the mode for each newly created directory.
;   dir must be a scaler.
;D. Larson, April, 2008
;
pro file_mkdir2,dir,_extra=ex,mode=mode,dlevel=dlevel,verbose=verbose

if file_test(/directory,dir) then  return

file_mkdir2,file_dirname(dir),mode=mode
dprint,'Creating new directory: ',dir,dlevel=dlevel,verbose=verbose
file_mkdir,dir
if keyword_set(mode) then file_chmod,dir,mode
return

end

