Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.08.25;
Скачать: CL | DM;

Вниз

ПоЙИск Файлов???   Найти похожие ветки 

 
Fog ©   (2003-08-08 23:01) [0]

Блин, уже 3 дня мучаюсь.. Немогу придумать алгоритм поиска файлов... Помогите!
зы:
ДА Я ЗНАЮ ФЦНКЦИИ FindFirs, FindNext, FileSearch!!!


 
Palladin ©   (2003-08-08 23:05) [1]

а в принципе чем тебе помочь то?


 
ferrik ©   (2003-08-08 23:06) [2]

Функции FindFirst и FindNext не устраивают?


 
Vulko ©   (2003-08-08 23:15) [3]


> Fog ©

Во всех факах есть то, что тебе нужно.


 
Fog ©   (2003-08-09 00:37) [4]

Ну хотябы подскажите как создать список всех вложенных папок в TStringList или String (Path1;Path2;path3)...


 
Vulko ©   (2003-08-09 03:14) [5]

Раз не понимаешь, как найти папки или файлы с помощью FindFirst и FindNext, то сделай проще. Есть такой компонент - DirectoryListBox. Дальше я думаю всё ясно.


 
Дмитрий Белькевич   (2003-08-09 03:15) [6]

function TForm1.GetFileList(FDirectory, Filter: string): TStringList;
var
ARec: TSearchRec;
Res: Integer;
DirList: TStringList;
FDir: TFileName;
begin
FDir := FDirectory;
if FDir[Length(FDir)] <> "\" then
FDir := FDir + "\";
Result := TStringList.Create;
DirList := TStringList.Create;
try
Res := FindFirst(FDir + "*", faAnyFile or faDirectory, ARec);
while Res = 0 do
begin
Application.ProcessMessages;
if ((ARec.Attr and faDirectory) > 0)
and (ARec.Name <> ".")
and (ARec.Name <> "..") then
DirList.Add(FDir + ARec.Name + "\");
if (ARec.Attr and faDirectory) = 0 then
if (MatchesMask(ARec.Name, Filter)) or (Filter = "*.*")then
Result.Add(FDir + ARec.Name);
Res := FindNext(ARec);
if (Res <> 0) and (DirList.count <> 0) then
begin
FindClose(ARec);
FDir := DirList.Strings[0];
DirList.Delete(0);
Res := FindFirst(FDir + "*", faAnyFile or faDirectory,
ARec);
end;
( ARec)
function TForm1.GetFileList(FDirectory, Filter: string): TStringList;
var
ARec: TSearchRec;
Res: Integer;
DirList: TStringList;
FDir: TFileName;
begin
FDir := FDirectory;
if FDir[Length(FDir)] <> "\" then
FDir := FDir + "\";
Result := TStringList.Create;
DirList := TStringList.Create;
try
Res := FindFirst(FDir + "*", faAnyFile or faDirectory, ARec);
while Res = 0 do
begin
Application.ProcessMessages;
if ((ARec.Attr and faDirectory) > 0)
and (ARec.Name <> ".")
and (ARec.Name <> "..") then
DirList.Add(FDir + ARec.Name + "\");
if (ARec.Attr and faDirectory) = 0 then
if (MatchesMask(ARec.Name, Filter)) or (Filter = "*.*")then
Result.Add(FDir + ARec.Name);
Res := FindNext(ARec);
if (Res <> 0) and (DirList.count <> 0) then
begin
FindClose(ARec);
FDir := DirList.Strings[0];
DirList.Delete(0);
Res := FindFirst(FDir + "*", faAnyFile or faDirectory,
ARec);
end;
end;
FindClose(ARec);
form5.Hide;
except
FindClose(ARec);
Result.Free;
form5.Hide;
end;
end;


 
Proger_XP ©   (2003-08-09 11:34) [7]

можно проще
текст модуля:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, FileCtrl;

type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
ListBox1: TListBox;
DirectoryListBox1: TDirectoryListBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var sr:TSearchRec;
Result:word;
begin
Result := FindFirst ("*.exe",faAnyFile,sr);
ListBox1.Clear;
While result=0 do
Begin
Result:=FindNext (sr);
ListBox1.Items.add(sr.name);
End;
end;

end.


 
Fog ©   (2003-08-09 16:17) [8]


> Дмитрий Белькевич

То что нужно!!! Спасибо огромное!!!



Страницы: 1 вся ветка

Текущий архив: 2003.08.25;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.021 c
1-81702
Yuliya
2003-08-11 09:49
2003.08.25
файл


14-81965
Gogerman
2003-08-06 16:49
2003.08.25
Нужно получить разницу переменных типа TDateTime в часах.


3-81582
Weare
2003-07-29 18:19
2003.08.25
Запрос SQL для TQuery.


1-81764
Berezne
2003-08-14 12:02
2003.08.25
Глюки при печати


8-81841
EK
2003-04-26 22:06
2003.08.25
mpeg4