program FullDir;

{ Zeigt ein Verzeichnis, und rekursiv alle Unterverzeichnisse, an.
 Benötigt eine TP-kompatible DOS- und System-Unit.

 Bitte beachten Sie, daß die Verwendung von Findfirst und Findnext
 unter Linux nicht empfehlenswert ist!

 Copyright (c) 10/99 by Sebastian Koppehel, <basti@bastisoft.de> }

uses
   Dos;

const
{$IFDEF LINUX}
   Sep = '/';
   Any = '*';
{$ELSE}
   Sep = '\';
   Any = '*.*';
{$ENDIF}

procedure List(Space, Path : String);
var
   sr  : SearchRec;
begin
   Path := Path + Sep;
   FindFirst(Path + Any,AnyFile,sr);
   while DosError = 0 do
   begin
      Writeln(Space + sr.Name);
      if (sr.Attr and Directory = Directory) and
	 (sr.Name <> '.') and (sr.Name <> '..') then
	 List(Space + '    ',Path + sr.Name);
      FindNext(sr);
   end;
   {$IFDEF LINUX}
   FindClose(sr);
   {$ENDIF}
end;

var
   Dir : String;

begin
   if ParamCount > 0 then Dir := ParamStr(1)
   else begin
      GetDir(0,Dir);
      {$IFDEF MSDOS}
      Dir := Copy(Dir,1,Length(Dir) - 1);
      {$ENDIF}
   end;
   List('',Dir);
end.

