Sun, 2 May 2004 07:00:56 +0100
> From: Rick Duley <[log in to unmask]>
> I am currently working on some language analysis software (both
> natural language and code) for use in my doctoral research. It
> would be ideal if I could set an application up to work its way
> through all the files in a folder automatically - that is, set it to
> work on a folder full of files and it will automatically process
> each of the files in the folder in succession.
> Does anyone have any idea of how this can be done?
This is a recursive directory search using GNAT.Directory_Operations:
procedure Scan_Directory (Named : Dir_Name_Str) is
Wd : Dir_Type;
Open (Dir => Wd,
Dir_Name => Named);
Str : String (1 .. 1024);
Last : Natural;
Read (Dir => Wd,
Str => Str,
Last => Last);
exit when Last = 0;
if Str (1 .. Last) /= "." and Str (1 .. Last) /= ".." then
if Is_Directory (Named & Str (1 .. Last)) then
(Named & Str (1 .. Last) & Directory_Separator);
Save_File (Named & Str (1 .. Last));
Close (Dir => Wd);
Save_File is the place where the work gets done.
Not so sure about the 1024!