if FindFirst(FPath, faDirectory, SearchRec) = 0 then ...
It works fine as long as I'm on a local drive. When I'm using a
mapped-drive on our fileserver (Novell Internetware 4.x from a Windows
95 workstation) every subdirectory, every file, everything returns true
from FindFirst.
I've searched the Win32 API help, looked at the Netware SDK, scoured the
usenet groups, and I've not yet discovered the solution. What am I
missing?
I apologize in advance if this question has been answered. And thanks
in advance for any help.
--
Teri Oster
tos...@showme.missouri.edu
University of Missouri
Columbia, MO
> I'm using the following code to search for subfolders in the folder given by
> FPath.
>
> if FindFirst(FPath, faDirectory, SearchRec) = 0 then ...
>
> It works fine as long as I'm on a local drive. When I'm using a
> mapped-drive on our fileserver (Novell Internetware 4.x from a Windows 95
> workstation) every subdirectory, every file, everything returns true from
> FindFirst.
To find every subdirectory of a directory, you need code similar to the
following:
FPath := 'C:\MyDirectory';
if FindFirst(FPath+'\*.*',faDirectory,SearchRec) = 0 then
with SearchRec do
repeat
if (Attr and faDirectory) <> 0 then
Writeln( 'Subdirectory: ', Name)
until FindNext(SearchRec) <> 0;
You should understand that the attribute mask (in this case faDirectory)
specifies which files are to be found *in addition* to all "normal" files.
This is why you have to explicitly check the attributes of the files you find.
You should also be aware that NetWare uses some of the attribute bits which
DOS does not define - you may sometimes need to consider the quantity
(SearchRec.Attr and faAnyFile) rather than plain old SearchRec.Attr
Chris.