List all files in a directory using java

=======List all file with their names in a existing directory  on your hard disk=====
        String walkImageDir="C://MyDirectory//imageFiles";
         File dir = new File(imageDir);
         System.out.println("===dir.isDirectory()====="+dir.isDirectory());
          
           if(dir.isDirectory()){
                File[] imgFiles = dir.listFiles();
                System.out.println("===file dir size:"+imgFiles.length);
                for(File image: imgFiles){
                     System.out.println("====images are :"+image.getName());
                   
                }
              }

Popular posts from this blog

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Upload file on Google cloud storage using Java servlet on google app engine

Android: where to run keytool command in android