Board index » delphi » Listing directory contents

Listing directory contents

Dineh-Jason;

Quote
> Could someone tell me how to do this?  Can't think of an
> algorithm that uses FindFirst, FindNext, GetDir...and the
> rest of the directory procedure which come with TP.
> Thanks.

Got something that might work for you, but it's too big to
post. Email me if you're really interested and I'll send it
off to you.

--

Regards,
Jim Wilson
(jawil...@ix.netcom.com)

 

Re:Listing directory contents


Could someone tell me how to do this?  Can't think of an
algorithm that uses FindFirst, FindNext, GetDir...and the
rest of the directory procedure which come with TP.
Thanks.

                                Jason

Re:Listing directory contents


Quote
Dineh-Jason Attakai wrote:

> Could someone tell me how to do this?  Can't think of an
> algorithm that uses FindFirst, FindNext, GetDir...and the
> rest of the directory procedure which come with TP.
> Thanks.

It's not too difficult:

program quickdir;

uses
  dos;

var
  s : searchrec;
  p : string;

begin
  getdir (0,p);
  if p[length(p)]<>'\' then
    p := concat (p,'\');
  p := concat (p,'*.*');
  findfirst (p,anyfile,s);
  while doserror=0 do
    begin
      writeln (s.name:13,s.size:12);
      findnext (s);
    end;
end.

Very simple, just lists all the files in the current directory along
with file sizes (tested to work with TP7).  You can experiment with it
and work on it and maybe make something useful of it.  :-)

Quote
>                                 Jason

--
Scott Earnest        | We now return you to our regularly |
set...@ix.netcom.com | scheduled chaos and mayhem. . . .  |

Other Threads