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());
                   
                }
              }

Comments

Popular posts from this blog

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'

Upload csv file at Google Cloud Storage using java

Read Images from a xlsx file using Apache POI