Here is a readymade procedure for scanning a folder and applying some action on each subfolder or file
procedure ScanFolder( src string );
var
sts : Integer ;
SR: TSearchRec;
begin
sts := FindFirst( src + '*.*' , faAnyFile , SR );
if sts = 0 then
begin
if ( SR.Name <> '.' ) and ( SR.Name <> '..' ) then
begin
//Put User Feedback here if desired
Application.ProcessMessages;
if pos('.', SR.Name) = 0 then
begin
//subfolder put your code for subfolder
scanFolder(src + SR.Name);
end
else
//file put your code for file
end;
while FindNext( SR ) = 0 do
begin
if ( SR.Name <> '.' ) and ( SR.Name <> '..' ) then
begin
//Put User Feedback here if desired
Application.ProcessMessages;
if Pos('.', SR.Name) = 0 then
begin
//subfolder put your code for subfolder
scanFolder(src + SR.Name);
end
else
//file put your code for file
end;
end;
FindClose( SR ) ;
end ;
end;
Search This Blog
Subscribe to:
Post Comments (Atom)
Searching duplicate Record
Very often we have to look for duplicate records in the database, Below is the query which can give you the result. SELECT COL1, COL2 , ...
-
Qs. 1-5. In each of the questions below are given two statements followed by two conclusions numbered I and II. You have to take the given s...
-
Qs.1-6. Find out the missing number. 1. 11 23 48 … 202 1) 100 2)...
-
Here is a readymade procedure for scanning a folder and applying some action on each subfolder or file procedure ScanFolder( src string ); v...
No comments:
Post a Comment