[jcifs] smbfile.listFiles() for only directories

Michael B Allen mba2000 at ioplex.com
Thu Sep 16 20:39:33 GMT 2004


MacDermid, Kenny said:
>> From: Michael B Allen [mailto:mba2000 at ioplex.com]
>>
>> On Tue, 14 Sep 2004 14:13:41 -0400
>> Michael B Allen <mba2000 at ioplex.com> wrote:
>>
>> > On Tue, 14 Sep 2004 08:28:26 -0600
>> > "MacDermid, Kenny" <kenny.macdermid at abridean.com> wrote:
>> >
>> > > Hello,
>> > >
>> > > I'm looking for a way to have jcifs only list directories on a
>> > > listFiles(). I was hoping that there might be a way to do this in
>> > > the request passed across the network,
>> >
>> > Use DosFileFilter("*", SmbFile.ATTR_DIRECTORY) with
>> listFiles(filter).
>
> Thanks for your quick reply.
>
> Tried this:
>
> listFiles(new jcifs.smb.DosFileFilter("*",
> jcifs.smb.SmbFile.ATTR_DIRECTORY))
>
> Still get back files :-(

Not all filesystems support directory filtering [1]. Is the remote system
NTFS? You could try to write a quick and dirty Win32 program using
FindFirstFileEx with FindExSearchLimitToDirectories to verify the JCIFS
behavior is correct.

Mike

[1]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/file_management_enumeration_types.asp


More information about the jcifs mailing list