Solved

File listing source

Posted on 1997-11-02
2
187 Views
Last Modified: 2010-04-16
Has anyone got source code for a file listing program that will allow me to do the following.
1) quick sorting procedure/function
2) Allow me to choose what files to display eg:- FileExts:=(txt,doc,diz,me), So that it will show files only with those extensions.
3) Long file name handling would be a bonus but optional.

I know this may be a big ask, But any help would be appreciated.

Many thanks in advance.
Renegade.
0
Comment
Question by:Renegade
2 Comments
 
LVL 1

Accepted Solution

by:
Odie earned 100 total points
Comment Utility
uses WinDos, Strings;

const
 Directory: String
          = 'C:\';
 NrOfMasks = 3;
 Masks: array[1..NrOfMasks] of String
           = ('*.bat', '*.sys', '*.exe');

var
 SearchRec: TSearchRec;
 X: Integer;
 PC: PChar;

begin
 GetMem(PC, 256);
 for X := 1 to NrOfMasks do begin
   StrPCopy(PC, Directory + Masks[X]);
   FindFirst(PC, faAnyFile, SearchRec);
   while (DosError = 0) do begin
     WriteLn(SearchRec.Name);
     FindNext(SearchRec);
   end;
 end;
 FreeMem(PC, 256);
 ReadLn;
end.

This is sorted for each extension separatly.  I can sort it for all at once if necessary.

You can easily add size, attr. etc. (see TSearchRec in help)
0
 

Author Comment

by:Renegade
Comment Utility
Thankyou for your help Odie. I should be able to use the routine in a dandy piece of snippet I found in the SWAG's to do what I want to do.

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now