function dirname = DirName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PURPOSE: Extract the current directory name from a full path.
% AUTHOR:  Rob McEwen
% DATE:    00/6/1
%
% Edited:  Nicole Tervalon, Aug 2002
%            Added ability to parse DOS directory file structure
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
 mpath     = pwd;
 remainder1 = mpath;
 
 while (~isempty(remainder1))
   [token1,remainder1]=strtok(remainder1,'\');
 end

 remainder2 = mpath;
 
 while (~isempty(remainder2))
   [token2,remainder2]=strtok(remainder2,'/');
 end
 
 if (length(token1)>length(token2))
   dirname = token2;
 else
   dirname = token1;
 end
 
 return;