Subversion Repositories svn.Prod repos

Rev

Rev 29 | Rev 31 | Go to most recent revision | Details | Compare with Previous | 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;
30 - 7
	Info : TSearchRec;
29 - 8
	pfile : string;
9
begin
10
	curdir1 := GetCurrentDir;
11
	chdir(directory);
12
	curdir2 := GetCurrentDir;
30 - 13
	FindFirst(directory + '/*', faAnyFile or faHidden, Info);
29 - 14
	repeat
30 - 15
		if ((Info.name <> '..') and (Info.name <> '.'))
29 - 16
		then
17
			begin
30 - 18
			pfile := curdir2 + '/' + Info.name;
29 - 19
			Writeln(pfile);
20
			if (DirectoryExists(pfile))
21
			then
22
				traverse(pfile)
23
			end
30 - 24
	until FindNext(Info) <> 0;
29 - 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);
30 - 36
	if (ParamCount = 1)
29 - 37
	then
30 - 38
		if DirectoryExists(directory)
39
		then
40
			start_traverse(directory)
41
		else
42
			Writeln ('ERROR: Not a directory : ', directory)
29 - 43
	else
30 - 44
		Writeln('ERROR: Give directory as argument');
29 - 45
end.