How to scan the file system in Java

Burningwave
1 min readNov 9, 2020

--

Through FileSystemItem of Burningwave Core library you can reach a resource of the file system even if it is contained in a nested supported (zip, jar, war, ear and jmod) compressed archive and obtain the content of it or other informations such as if it is a folder or a file or a compressed archive or if it is a compressed entry or obtain, if it is a folder or a compressed archive, the direct children or all nested children or a filtered collection of them. You can retrieve a FileSystemItem through an absolute path or through a relative path referred to your classpath by using the PathHelper. FileSystemItems are cached and there will only be one instance of them for an absolute path and you can also clear the cache e reload all informations of a FileSystemItem.

To use FileSystemItem you should simply add the following to your projects dependencies:

In the example below we show how to retrieve and use a FileSystemItem.

In this article we learned how to scan the file system and the complete source of this example is available here. For more articles about Burningwave Core you can go to the main page.

--

--

Burningwave

A collection of Java libraries for building frameworks and applications: https://www.burningwave.org