How to read system directory and files in java code examples


public class TestDirReader{

  public static void main(String[] args) {

              File folder = new File("C://testDir");

            File[] filesList= folder.listFiles();

            for (int i = 0; i < filesList.length; i++) {
              if (filesList[i].isDirectory()) {
                System.out.println("Directory Name :" + filesList[i].getName());
              }else if (filesList[i].isFile()) {
                System.out.println("File Name :" + filesList[i].getName());




Popular posts from this blog

What is NBioBSP Java Library?

Draw arrow line example

Capture image from webcam java code, examples