DEV Community

loading...
Cover image for Listing all the files & subdirectories laying down in the Path recursively [Java]

Listing all the files & subdirectories laying down in the Path recursively [Java]

Vusal Ismayilov
Python & Java & C/C++ & Discord/Slack BOT Developer, AI, ML, CV, DL Researcher, Data Science, IoT, Autonomous Drones/UAV
・1 min read

In one of my previous stories, I have shared a simple Python script, which used to list all the used libraries in the .py extended, in other words, Python files, and returned the result in a requirements.txt file. 

This time, even though the general principle is the same, whole project is going to be a little bit harder compared to the Python, the first reason being that we are already working Java, not Python, but the most important part is that we are going to use the recursive functions. 

The result at the end is going to get all the directory, subdirectories, files, and file (not folder) sizes in bytes as shown in the image below:

Code Sample Show

Source Code (GitHub): https://github.com/woosal1337/Listing-Subdirectories-Files-Sizes

Medium: https://woosal1337.medium.com/listing-all-the-files-subdirectories-laying-down-in-the-path-recursively-java-6b7fa1080068

LinkedIn: https://www.linkedin.com/in/woosal1337/

Discussion (0)