Solved

File listing source

Posted on 1997-11-02
2
213 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
ID: 1216421
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
ID: 1216422
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

679 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