I'm trying to download a file via an ftp(s) server with apache vfs. Here is the code:
`
String fileToDownload="testdownload.txt";
FileSystem fs = null;
FileSystemOptions opts = new FileSystemOptions();
FtpFileSystemConfigBuilder.getInstance().setPassiveMode(opts, true);
FileSystemManager manager = VFS.getManager();
//
// Create local file object
String filepath = "d:\\butta\\" + "stoca.txt";
File file = new File(filepath);
FileObject localFile = manager.toFileObject(file);
FileObject remote = manager.resolveFile("ftps://user:pwd@ftp-test/DOWNLOAD/"+fileToDownload,opts);
//fs = remote.getFileSystem();
System.out.println("path is:" + remote.getName().getPath());
System.out.println("tipe is: " + remote.getName().getType());
System.out.println("uri is: " + remote.getName().getURI());
localFile.copyFrom(remote, Selectors.SELECT_SELF);
localFile.close();
remote.close();
`
I can connect seamlessy to the server,and I can retrieve path,type (which is file) and uri. All seems correct but the copyFrom gives: Could not copy "my filename" because it does not exist. at org.apache.commons.vfs2.provider.AbstractFileObject.copyFrom(AbstractFileObject.java:271)
I'm running on windows and I can download the file via Filezilla or winscp without problems