How to access file system in java?

I need to iterate a folder on the local computer from the server to parse some files. This is real? If this is true, please tell me how to do it.

+5
source share
4 answers

You can also take a look at the new nio.2 package in Java 7 with here .

A lot of new and powerful things.

+2
source

I prefer Commons VFS . It can handle local file systems, SFTP and many others. All with the same code - you just change the file paths.

FileSystemManager fsManager = VFS.getManager();
FileObject directory = fsManager.resolveFile("path/to/dir");
FileObject[] files = directory.findFiles(fileSelector);

for (FileObject file : files) {
    // do something
}
+7
source

SSH, FTP FTPS, . HTTP, = true, HTTP , .

0

, ​​ clietn ( Server PC) . FTP- , .

0

All Articles