Рекурсивный проход дерева каталогов

Советы » Каталоги » Рекурсивный проход дерева каталогов

procedure

ScanDir(Dir: string

); var

SearchRec: TSearchRec; begin

if

Dir <> '' then

if

Dir[length(Dir)] <> '' then

Dir := Dir + ''; if

FindFirst(Dir + '*.*', faAnyFile, SearchRec) = 0 then

repeat

if

(SearchRec.name = '.') or

(SearchRec.name = '..') then

continue; if

(SearchRec.Attr and

faDirectory) <> 0 then

ScanDir(Dir + SearchRec.name) //we found Directory: "Dir+SearchRec.name" else

Showmessage(Dir + SearchRec.name); //we found File: "Dir+SearchRec.name" until

FindNext(SearchRec) <> 0; FindClose(SearchRec); end

; procedure

TForm1.Button1Click(Sender: TObject); begin

ScanDir('c:'); end

;

Другое по теме:

Категории

Статьи

Советы

Copyright © 2022 - All Rights Reserved - www.delphirus.com