function ll(theDirectory) % ll -- Verbose directory listing. % ll('theDirectory') lists the modification-date, % byte-length, directory-flag, and name of each % element in 'theDirectory', which defaults to % the current directory. % Copyright (C) 2000 Dr. Charles R. Denham, ZYDECO. % All Rights Reserved. % Disclosure without explicit written consent from the % copyright owner does not constitute publication. % Version of 18-Apr-2000 21:43:16. % Updated 18-Apr-2000 22:04:00. if nargin < 1, theDirectory = pwd; end d = dir(theDirectory); maxname = 0; for i = 1:length(d) maxname = max(maxname, length(d(i).name)); end blank = char(zeros(1, maxname) + abs(' ')); for i = 1:length(d) nm = blank; nm(1:length(d(i).name)) = d(i).name; d(i).name = nm; end maxbytes = 0; for i = 1:length(d) maxbytes = max(maxbytes, length(int2str(d(i).bytes))); end blank = char(zeros(1, maxbytes) + abs(' ')); for i = 1:length(d) by = int2str(d(i).bytes); while length(by) < maxbytes by = [' ' by]; end d(i).bytes = by; end for i = 1:length(d) if d(i).isdir d(i).isdir = 'dir'; else d(i).isdir = ' '; end end disp(' ') disp([' Directory: ' theDirectory]) disp(' ') for i = 1:length(d) disp([' ' d(i).date ' ' d(i).bytes ' ' d(i).isdir ' ' d(i).name]) end disp(' ')