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

Вниз

Как?   Найти похожие ветки 

 
Xtorm   (2001-12-19 10:40) [0]

Как получить весь список файлов и папок допустим на диске с:\
только без помощи компонентов???


 
Bizon ©   (2001-12-19 10:46) [1]

Воспользуйся ф-ями FindFirst & FindNext


 
Dimka Maslov ©   (2001-12-19 10:52) [2]

procedure FindFiles(Path, Mask: string; List: TStrings; IncludeSubDir: Boolean = True);
var
SearchRec: TSearchRec;
FindResult: Integer;
begin
List.BeginUpdate;
try
Path:=IncludeTrailingBackSlash(Path);
FindResult:=FindFirst(Path+"*.*", faAnyFile, SearchRec);
try
while FindResult = 0 do with SearchRec do begin
if (Attr and faDirectory<>0) then begin
if IncludeSubDir and (Name<>"..") and (Name<>".")
then FindFiles(Path+Name, Mask, List, IncludeSubDir);
end else begin
if MatchesMask(Name, Mask) then List.Add(Path+Name);
end;
FindResult:=FindNext(SearchRec);
end;
finally
FindClose(SearchRec);
end;
finally
List.EndUpdate;
end;
end;


 
cpp   (2001-12-19 10:53) [3]

Вот и моих исходников можешь подстроить под себя

procedure ReadAllFiles(DirFrom : string);
var SearchRecOtkuda : TSearchRec;



procedure ReadFile(FileName : string);
begin
// что хочем то и делаем с файлом
end;

procedure ReadDir(DirName : string);
begin
// что хочем то и делаем с директорием
if (DirName <> ".") and (DirName <> "..") then
begin
ReadAllFiles(DirFrom+"\"+DirName);
end;
end;

begin
if FindFirst(DirFrom+"\*.*",faAnyFile,SearchRecOtkuda) = 0 then
begin
if (faDirectory and SearchRecOtkuda.Attr) > 0 then
ReadDir(SearchRecOtkuda.Name)
else
ReadFile(SearchRecOtkuda.Name);
while FindNext(SearchRecOtkuda) = 0 do
begin
if (faDirectory and SearchRecOtkuda.Attr) > 0 then
ReadDir(SearchRecOtkuda.Name)
else
ReadFile(SearchRecOtkuda.Name);
end;
end;
end;


 
Xtorm   (2001-12-19 11:39) [4]

СПАСИБО Всем все теперь работает!!!!



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

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

Наверх




Память: 0.47 MB
Время: 0.018 c
3-21918
SVS
2001-12-04 13:11
2002.01.08
заполнение OleContainer из BlobField


3-21984
Mr. Andrew
2001-12-05 20:39
2002.01.08
Обновление данных


1-22000
Striker
2001-12-13 07:59
2002.01.08
Перенос данных в ячейку листа Excel


1-22005
Cossys
2001-12-17 16:57
2002.01.08
Вывод всех форм приложения с активными заголовками


1-22061
Колеся
2001-12-18 19:44
2002.01.08
почему MDI форма не отображает MDIChild в меню ???