Categories: java, jcifs

JCIFS SmbFile.exists() and SmbFile.isDirectory() return false when it exists and I can listFiles()

1 answer

I can't get .exists() or .isDirectory() to return true for a subfolder that exists, from which I can .listFiles() and get the expected result.

subfolder = createSmbFile("smb://my-server/uploads/subfolder"); log.debug(subfolder.exists() + "/" + subfolder.isDirectory()); 

produces "false/false". Yet calling .listFiles() would return an array of [file1, file2, file3...]. I've been able to implement uploading and downloading of specific files by name (ending with an extension) without issue.

What am I doing wrong?

Edit: This is my jcifs version btw

<dependency>      <groupId>eu.agno3.jcifs</groupId>      <artifactId>jcifs-ng</artifactId>      <version>2.1.4</version> </dependency> 

All answers to this question, which has the identifier 61239051

The best answer:

The problem seems to have been that the SmbFile#uncPath() was my-server/uploads/subfolder, not my-server/subfolder, as despite the hierarchical relationship between servers/filesystems, methods like exists() and isHidden() don't work like one might expect, and instead always return false.

Debugging through it and looking at the SmbFile's fileLocator property showed this.

It was explained here.

Last questions

how do i remove the switch on my home screen?
how to edit the JS date and time to update atuomatically?
How to utilize data stored in a multidimensional array
Powermockito not mocking URL constructor in URI.toURL() method
Android Bluetooth LE Scanner only scans when phone's Location is turned on in some devices
docker wordpress container can't connect to mysql container
How can I declare a number in java that is more than 64-bits? [duplicate]
Optaplanner solutionClass entityCollectionProperty should never return null error when simple JSON object passed to controller
Anylogic, get the time a pedestrain is in a queue
How do I fix this syntax issue with my .flex file?
Optimizing query in PHP
How to find the highest number of a column and print two columns of that row in R?
Ideas on “Error: Type com.google.firebase.iid.zzav is referenced as an interface from com.google.firebase.messaging.zzd”?
JCIFS SmbFile.exists() and SmbFile.isDirectory() return false when it exists and I can listFiles()
PHP total order
Laravel booking system design
neural net - undefined column selected
How to indicate y axis does not start from 0 in ggplot?
Fragments in backStack
Spinner how to change the data