Revision 495
(checked in by cbc, 12 years ago)
|
Initial import of Stark code.
|
Line | |
---|
1 |
function result = dirinfo |
---|
2 |
|
---|
3 |
% dirinfo -- Information about current-directory. |
---|
4 |
% dirinfo (no argument) returns information about |
---|
5 |
% the current-directory: number of files, directories, |
---|
6 |
% and bytes. The tally works recursively through all |
---|
7 |
% the embedded directories. |
---|
8 |
|
---|
9 |
% Copyright (C) 2001 Dr. Charles R. Denham, ZYDECO. |
---|
10 |
% All Rights Reserved. |
---|
11 |
% Disclosure without explicit written consent from the |
---|
12 |
% copyright owner does not constitute publication. |
---|
13 |
|
---|
14 |
% Version of 25-Sep-2001 15:15:24. |
---|
15 |
% Updated 25-Sep-2001 15:20:54. |
---|
16 |
|
---|
17 |
files = 0; |
---|
18 |
dirs = 0; |
---|
19 |
bytes = 0; |
---|
20 |
|
---|
21 |
d = dir; |
---|
22 |
|
---|
23 |
for i = 1:length(d) |
---|
24 |
if d(i).isdir |
---|
25 |
cd(d(i).name) |
---|
26 |
y = feval(mfilename); |
---|
27 |
files = files + y.files; |
---|
28 |
dirs = dirs + 1; |
---|
29 |
bytes = bytes + y.bytes; |
---|
30 |
cd .. |
---|
31 |
else |
---|
32 |
files = files + 1; |
---|
33 |
bytes = bytes + d(i).bytes; |
---|
34 |
end |
---|
35 |
end |
---|
36 |
|
---|
37 |
x.files = files; |
---|
38 |
x.dirs = dirs; |
---|
39 |
x.bytes = bytes; |
---|
40 |
|
---|
41 |
if nargout > 0 |
---|
42 |
result = x; |
---|
43 |
else |
---|
44 |
disp(x) |
---|
45 |
end |
---|