commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Eckenfels <>
Subject Re: How to list out files from UNC path?
Date Wed, 13 Sep 2017 13:21:06 GMT
I think the code looks fine, the URL needs to be in VFS syntax (you need to convert the UNC
path into "smb://host/share/dir" and the SMB provider with jcifs library needs to be on the

From: prabhu Mahendran <>
Sent: Wednesday, September 13, 2017 2:42:44 PM
To: Commons Users List
Subject: Re: How to list out files from UNC path?

Hi Bernd,

Thanks for your response.

I have tried commons-vfs-2.1.jar with following code to get files inside
folder in windows OS.

StaticUserAuthenticator auth = new StaticUserAuthenticator("domainname",
"username", "password");
FileSystemOptions opts = new FileSystemOptions();
FileObject fo =
VFS.getManager().resolveFile("\\\\servername\\directory\\foldername", opts);
FileObject[] fos=fo.getChildren();

In that works correctly when i mount the \\\\servername\\directory\\folder
into my fileexplorer.

Since am using this command "net use /d *" to delete default credentials
stored in windows while accessing unc path.Because my UNC path process one
time validation for credentials.Once validation success for one time then
next time it not prompts for credentials it directly enters into folder.

Once i executed that net use command successfully then run my api using vfs
jar it could not get children of that shared folder present in UNC Path.

am googling but not find better solution.

Could you give any suggestion for solve that issue?


On Wed, Sep 13, 2017 at 5:08 PM, Bernd Eckenfels <>

> Hello,
> Yes and no. With the Cifs provider contained in the VFS Sandbox you can
> directly connect to a SMB1.0 server (and use the normal VFS API to list
> files). However for licensing reasons we do not ship binaries, so you have
> to compile the provider on your own. The other problem is, that it only
> supports SMB1.0 with increasingly gets switched off.
> A new component which fixes both problems (based on smbj) is in the makes.
> You can check the development mailing list archive for the Github fork. I
> haven't however yet used it personally so I am not quite sure how far it is
> (but I would assume listing files works).
> Gruss
> Bernd
> --
> ________________________________
> From: prabhu Mahendran <>
> Sent: Wednesday, September 13, 2017 12:41:52 PM
> To:
> Subject: How to list out files from UNC path?
> Hi All,
> Is this possible to list out files present in UNC
> Path(//hostname/foldername) with valid credentials using VFS library?
> Generally I wants to get files present in network folder in which needs
> credentials  to access files.
> Now i need to list out files using java api.
> Can anyone suggest me way to do that?
> Thanks,
> Mahendran

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message