Rev 29 | Rev 31 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 29 | Rev 30 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | Uses sysutils; |
2 | Uses sysutils; |
3 | var directory : string; |
3 | var directory : string; |
4 | 4 | ||
5 | procedure traverse(directory : string); |
5 | procedure traverse(directory : string); |
6 | var curdir1, curdir2 : string; |
6 | var curdir1, curdir2 : string; |
7 | Info3 : TSearchRec; |
7 | Info : TSearchRec; |
8 | pfile : string; |
8 | pfile : string; |
9 | begin |
9 | begin |
10 | curdir1 := GetCurrentDir; |
10 | curdir1 := GetCurrentDir; |
11 | chdir(directory); |
11 | chdir(directory); |
12 | curdir2 := GetCurrentDir; |
12 | curdir2 := GetCurrentDir; |
13 | FindFirst(directory + '/*', faAnyFile or faHidden, Info3); |
13 | FindFirst(directory + '/*', faAnyFile or faHidden, Info); |
14 | repeat |
14 | repeat |
15 | if ((Info3.name <> '..') and (Info3.name <> '.')) |
15 | if ((Info.name <> '..') and (Info.name <> '.')) |
16 | then |
16 | then |
17 | begin |
17 | begin |
18 | pfile := curdir2 + '/' + Info3.name; |
18 | pfile := curdir2 + '/' + Info.name; |
19 | Writeln(pfile); |
19 | Writeln(pfile); |
20 | if (DirectoryExists(pfile)) |
20 | if (DirectoryExists(pfile)) |
21 | then |
21 | then |
22 | traverse(pfile) |
22 | traverse(pfile) |
23 | end |
23 | end |
24 | until FindNext(Info3) <> 0; |
24 | until FindNext(Info) <> 0; |
25 | chdir(curdir1); |
25 | chdir(curdir1); |
26 | end; |
26 | end; |
27 | 27 | ||
28 | procedure start_traverse(directory : string); |
28 | procedure start_traverse(directory : string); |
29 | begin |
29 | begin |
Line 31... | Line 31... | ||
31 | traverse(directory); |
31 | traverse(directory); |
32 | end; |
32 | end; |
33 | 33 | ||
34 | begin |
34 | begin |
35 | directory := ParamStr(1); |
35 | directory := ParamStr(1); |
36 | if DirectoryExists(directory) |
36 | if (ParamCount = 1) |
37 | then |
37 | then |
- | 38 | if DirectoryExists(directory) |
|
- | 39 | then |
|
38 | start_traverse(directory) |
40 | start_traverse(directory) |
- | 41 | else |
|
- | 42 | Writeln ('ERROR: Not a directory : ', directory) |
|
39 | else |
43 | else |
40 | Writeln ('Not a directory : ', directory) |
44 | Writeln('ERROR: Give directory as argument'); |
41 | end. |
45 | end. |