Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Down

How? Find similar branches


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]

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



Pages: 1 whole branch

Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Top















Memory: 0.82 MB
Time: 0.026 c
1-22257
Dmitry1
2001-12-14 16:53
2002.01.08
Good day


14-22317
Tosov
2001-10-31 23:58
2002.01.08
Delphi 6


3-21947
Diehard
2001-12-05 13:18
2002.01.08
Получение из таблицы Oracle списка индексов


1-22105
Gonza
2001-12-19 16:35
2002.01.08
MDI Application ???


14-22328
Novice
2001-11-02 14:48
2002.01.08
Я уже задолбался!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian spanish swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish