Rev 31 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 31 | Rev 37 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | program filefind; |
1 | program filefind; |
2 | Uses sysutils; |
2 | Uses sysutils; |
3 | var directory : string; |
3 | var directory : string; |
- | 4 | var progname : string; |
|
4 | 5 | ||
5 | // ============================================================================ |
6 | // ============================================================================ |
6 | // Functions |
7 | // Functions |
7 | // ============================================================================ |
8 | // ============================================================================ |
8 | 9 | ||
- | 10 | procedure Usage(mesg : string); |
|
- | 11 | begin |
|
- | 12 | Writeln('Usage: ' + progname + ' directory'); |
|
- | 13 | Writeln(mesg); |
|
- | 14 | end; |
|
- | 15 | ||
9 | procedure traverse(directory : string); |
16 | procedure traverse(directory : string); |
10 | var curdir1, curdir2 : string; |
17 | var curdir1, curdir2 : string; |
11 | Info : TSearchRec; |
18 | Info : TSearchRec; |
12 | pfile : string; |
19 | pfile : string; |
13 | begin |
20 | begin |
Line 38... | Line 45... | ||
38 | // ============================================================================ |
45 | // ============================================================================ |
39 | // Main |
46 | // Main |
40 | // ============================================================================ |
47 | // ============================================================================ |
41 | 48 | ||
42 | begin |
49 | begin |
- | 50 | progname := ParamStr(0); |
|
43 | directory := ParamStr(1); |
51 | directory := ParamStr(1); |
44 | if (ParamCount = 1) |
52 | if (ParamCount = 1) |
45 | then |
53 | then |
46 | if DirectoryExists(directory) |
54 | if DirectoryExists(directory) |
47 | then |
55 | then |
48 | start_traverse(directory) |
56 | start_traverse(directory) |
49 | else |
57 | else |
50 | Writeln ('ERROR: Not a directory : ', directory) |
58 | Usage('ERROR: Not a directory : ' + directory) |
51 | else |
59 | else |
52 | Writeln('ERROR: Give directory as argument'); |
60 | Usage('ERROR: 1 argument expected'); |
53 | end. |
61 | end. |