09.12.2012, 13:15
|
|
Активный
|
|
Регистрация: 19.11.2011
Адрес: Украина, Луганская обл.
Сообщения: 244
Версия Delphi: 7, XE, Lazarus
Репутация: выкл
|
|
Код:
procedure GetAllFiles(Path: string; ListBox: TListBox );
var
sRec: TSearchRec;
isFound: Boolean;
begin
Path := IncludeTrailingPathDelimiter(Path);
isFound := FindFirst(Path + '\*.*', faAnyFile, sRec) = 0;
while isFound do
begin
if (sRec.Name <> '.') and (sRec.Name <> '..') then
begin
if (sRec.Attr and faDirectory) = faDirectory then
GetAllFiles(Path + sRec.Name, ListBox);
if Pos('.mp3', Copy(sRec.Name, Length(sRec.Name)-3, 4)) = 1 then
ListBox.Items.Add(Path + sRec.Name);
if Pos('.AAC', Copy(sRec.Name, Length(sRec.Name)-3, 4)) = 1 then
ListBox.Items.Add(Path + sRec.Name);
end;
Application.ProcessMessages;
isFound := FindNext(sRec) = 0;
end;
FindClose(sRec);
end;
|