program filefind;
Uses sysutils;
var directory : string;
procedure traverse(directory : string);
var curdir1, curdir2 : string;
Info : TSearchRec;
pfile : string;
begin
curdir1 := GetCurrentDir;
chdir(directory);
curdir2 := GetCurrentDir;
FindFirst(directory + '/*', faAnyFile or faHidden, Info);
repeat
if ((Info.name <> '..') and (Info.name <> '.'))
then
begin
pfile := curdir2 + '/' + Info.name;
Writeln(pfile);
if (DirectoryExists(pfile))
then
traverse(pfile)
end
until FindNext(Info) <> 0;
chdir(curdir1);
end;
procedure start_traverse(directory : string);
begin
Writeln(directory);
traverse(directory);
end;
begin
directory := ParamStr(1);
if (ParamCount = 1)
then
if DirectoryExists(directory)
then
start_traverse(directory)
else
Writeln ('ERROR: Not a directory : ', directory)
else
Writeln('ERROR: Give directory as argument');
end.