[jcifs] SmbFile.listFiles returning too low number of files

Volker Schmelich volker at quadnova.com
Tue Apr 12 13:29:11 MDT 2011

Hi there,

We experience a strange issue on one of our Windows PCs with jCIFS
1.3.14 and 1.3.15. The Windows PC is running Windows 7 Home Premium x64
with SP1. We use JDK 1.6.0_24 both 32 bit and 64 bit.

When we call SmbFile.listFiles(), the method does not return all files
available in the directory. E.g. we have 1146 files in there, but the
method returns 1094 and sometimes 1127 (when we let it run in a loop
with 1s delay).

The bug is reproducible on this one PC every time we use more than about
200 files. It works fine on one of our Windows 2000 and one of our 2003
servers and other Windows 7 PCs, too.

This Java snippet is as simple as it gets to reproduce it:

String sourceDir =
SmbFile src = new SmbFile(sourceDir);
SmbFile[] list = src.listFiles();
int cnt1 = list.length;

As copyTo depends on listFiles, copying all the files in the directory
does not copy all of them, only those returned by listFiles.

There are no exceptions, no stack traces. The example above uses the
plain JAR file, no extra jCFIS configurations.

We also tried jcifs.smb.client.attrExpirationPeriod = 0 with no

Is there any direction you could point us - we tried to figure it out
for hours but we are lost.


More information about the jCIFS mailing list