Solved

File listing source

Posted on 1997-11-02
2
204 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

When we purchase storage, we typically are advertised storage of 500GB, 1TB, 2TB and so on. However, when you actually install it into your computer, your 500GB HDD will actually show up as 465GB. Why? It has to do with the way people and computers…
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

772 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