So, I have this FTP server with a bunch of folders and files inside.
My program should access this server, read all the files and display their data.
For development purposes, I worked with files on my hard drive directly in the "src" folder.
But now that the server is up and running, I need to connect the software to it.
Basically, I want to get a list of files in a specific folder on the server.
This is what I have so far:
URL url = null; File folder = null; try { url = new URL ("ftp://username: password@www.superland.example /server"); folder = new File (url.toURI()); } catch (Exception e) { e.printStackTrace(); } data = Arrays.asList(folder.listFiles(new FileFilter () { public boolean accept(File file) { return file.isDirectory(); } }));
But I get the error "The URI scheme is not a file."
I understand this because my URL starts with "ftp: //" and not "file:"
However, I cannot understand what I should do with this!
Maybe there is a better way to do this?
source share