How to list out files from UNC path?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to list out files from UNC path?

prabhu Mahendran
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
Reply | Threaded
Open this post in threaded view
|

Re: How to list out files from UNC path?

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
--
http://bernd.eckenfels.net
________________________________
From: prabhu Mahendran <[hidden email]>
Sent: Wednesday, September 13, 2017 12:41:52 PM
To: [hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: How to list out files from UNC path?

prabhu Mahendran
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();
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts,
auth);
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?

Best,
Mahendran



On Wed, Sep 13, 2017 at 5:08 PM, Bernd Eckenfels <[hidden email]>
wrote:

> 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
> --
> http://bernd.eckenfels.net
> ________________________________
> From: prabhu Mahendran <[hidden email]>
> Sent: Wednesday, September 13, 2017 12:41:52 PM
> To: [hidden email]
> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: How to list out files from UNC path?

Bernd Eckenfels
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 classpath.

Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
From: prabhu Mahendran <[hidden email]>
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();
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts,
auth);
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?

Best,
Mahendran



On Wed, Sep 13, 2017 at 5:08 PM, Bernd Eckenfels <[hidden email]>
wrote:

> 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
> --
> http://bernd.eckenfels.net
> ________________________________
> From: prabhu Mahendran <[hidden email]>
> Sent: Wednesday, September 13, 2017 12:41:52 PM
> To: [hidden email]
> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: How to list out files from UNC path?

prabhu Mahendran
Am more interested to use apache license libraries only.

Can you please tell me that Jcifs applicable under common-vfs library or
both libraries different?
On 13-Sep-2017 6:51 PM, "Bernd Eckenfels" <[hidden email]> wrote:

> 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 classpath.
>
> Gruss
> Bernd
> --
> http://bernd.eckenfels.net
> ________________________________
> From: prabhu Mahendran <[hidden email]>
> 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();
> DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts,
> auth);
> 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?
>
> Best,
> Mahendran
>
>
>
> On Wed, Sep 13, 2017 at 5:08 PM, Bernd Eckenfels <[hidden email]>
> wrote:
>
> > 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
> > --
> > http://bernd.eckenfels.net
> > ________________________________
> > From: prabhu Mahendran <[hidden email]>
> > Sent: Wednesday, September 13, 2017 12:41:52 PM
> > To: [hidden email]
> > 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
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: How to list out files from UNC path?

Bernd Eckenfels
Hello,

Not sure I understand your question, for current VFS you need VFS Core, VFS Sandbox Provider and jCIFS library. https://commons.apache.org/proper/commons-vfs/download.html describes how to build the Sandbox code.

The new version with a modern (and better licensed) smbj variant will be included when it is ready, the work is going on here: https://github.com/codyswanson4/commons-vfs/commits/trunk thanks to Cody Swanson.

Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
From: prabhu Mahendran <[hidden email]>
Sent: Wednesday, September 13, 2017 4:11:26 PM
To: Commons Users List
Subject: Re: How to list out files from UNC path?

Am more interested to use apache license libraries only.

Can you please tell me that Jcifs applicable under common-vfs library or
both libraries different?
On 13-Sep-2017 6:51 PM, "Bernd Eckenfels" <[hidden email]> wrote:

> 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 classpath.
>
> Gruss
> Bernd
> --
> http://bernd.eckenfels.net
> ________________________________
> From: prabhu Mahendran <[hidden email]>
> 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();
> DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts,
> auth);
> 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?
>
> Best,
> Mahendran
>
>
>
> On Wed, Sep 13, 2017 at 5:08 PM, Bernd Eckenfels <[hidden email]>
> wrote:
>
> > 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
> > --
> > http://bernd.eckenfels.net
> > ________________________________
> > From: prabhu Mahendran <[hidden email]>
> > Sent: Wednesday, September 13, 2017 12:41:52 PM
> > To: [hidden email]
> > 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
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: How to list out files from UNC path?

prabhu Mahendran
Hi Bernd,

Thanks for your suggestions.

But i wants to list out files with help of commons-vfs jar only not to use
jcifs library.

I have executed that code in java api after running this cmd in command
prompt "*net use /d **"  then above code not works.

That code throws below error.,

*org.apache.commons.vfs2.FileNotFolderException: Could not list the
contents of "file:////servername//directory//foldername" because it is not
a folder.*

i don't know what happened to vfs when running net use /d * command in
windows.

*Am not able to find root cause for that problem?*

*Can you help me to solve that exception?*

Many thanks,
mahendran

On Thu, Sep 14, 2017 at 1:50 AM, Bernd Eckenfels <[hidden email]>
wrote:

> Hello,
>
> Not sure I understand your question, for current VFS you need VFS Core,
> VFS Sandbox Provider and jCIFS library. https://commons.apache.org/
> proper/commons-vfs/download.html describes how to build the Sandbox code.
>
> The new version with a modern (and better licensed) smbj variant will be
> included when it is ready, the work is going on here: https://github.com/
> codyswanson4/commons-vfs/commits/trunk thanks to Cody Swanson.
>
> Gruss
> Bernd
> --
> http://bernd.eckenfels.net
> ________________________________
> From: prabhu Mahendran <[hidden email]>
> Sent: Wednesday, September 13, 2017 4:11:26 PM
> To: Commons Users List
> Subject: Re: How to list out files from UNC path?
>
> Am more interested to use apache license libraries only.
>
> Can you please tell me that Jcifs applicable under common-vfs library or
> both libraries different?
> On 13-Sep-2017 6:51 PM, "Bernd Eckenfels" <[hidden email]> wrote:
>
> > 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 classpath.
> >
> > Gruss
> > Bernd
> > --
> > http://bernd.eckenfels.net
> > ________________________________
> > From: prabhu Mahendran <[hidden email]>
> > 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();
> > DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts,
> > auth);
> > 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?
> >
> > Best,
> > Mahendran
> >
> >
> >
> > On Wed, Sep 13, 2017 at 5:08 PM, Bernd Eckenfels <[hidden email]
> >
> > wrote:
> >
> > > 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
> > > --
> > > http://bernd.eckenfels.net
> > > ________________________________
> > > From: prabhu Mahendran <[hidden email]>
> > > Sent: Wednesday, September 13, 2017 12:41:52 PM
> > > To: [hidden email]
> > > 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
> > >
> >
>