Subversion Repositories svn.Prod repos

Rev

Rev 30 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
29 - 1
program filefind;
2
Uses sysutils;
3
var	directory : string;
4
 
5
procedure traverse(directory : string);
6
var	curdir1, curdir2 : string;
7
	Info3 : TSearchRec;
8
	pfile : string;
9
begin
10
	curdir1 := GetCurrentDir;
11
	chdir(directory);
12
	curdir2 := GetCurrentDir;
13
	FindFirst(directory + '/*', faAnyFile or faHidden, Info3);
14
	repeat
15
		if ((Info3.name <> '..') and (Info3.name <> '.'))
16
		then
17
			begin
18
			pfile := curdir2 + '/' + Info3.name;
19
			Writeln(pfile);
20
			if (DirectoryExists(pfile))
21
			then
22
				traverse(pfile)
23
			end
24
	until FindNext(Info3) <> 0;
25
	chdir(curdir1);
26
end;
27
 
28
procedure start_traverse(directory : string);
29
begin
30
	Writeln(directory);
31
	traverse(directory);
32
end;
33
 
34
begin
35
	directory := ParamStr(1);
36
	if DirectoryExists(directory)
37
	then
38
		start_traverse(directory)
39
	else
40
		Writeln ('Not a directory : ', directory)
41
end.