commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Indudhar Devanath <indud...@gmail.com>
Subject Re: [vfs] How to resolve a share path to a FileObject
Date Mon, 11 Jun 2012 11:51:30 GMT
>
> I'm trying to use VFS2 to copy a file from a remote path to a local folder.
>
> If I run
>
> FileObject srcFile = fsManager.resolveFile(//+hostname+"/"+filename);
>
> localFile.getName().getURI() returns something like file:////path and
> srcFile.exists() returns false.
>
> On the othe hand
>
> FileObject srcFile =
>
> fsManager.resolveFile("smb://"+user+":"+pw+"@"+hostname+"/"+filename);
>
> fails with the following exception:
>
> Badly formed URI "smb://user:***@hostname/filename"
>

Did you try checking if you can access the file with URI
"smb://user:***@hostname/filename"
There are chances that this URI might indeed be badly formed.

Also try this:
String srcURI = "smb://"+user+":"+pw+"@"+hostname+"/"+filename;
FileObject srcFile = fsManager.resolveFile(srcURI, new FileSystemOptions());

Indu

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