+92 332 4229 857 99ProjectIdeas@Gmail.com

Showing Files In Directory (Java)


Showing files/folders in a directory:


The following code shows you how to view those files and folders in the mentioned folder or directory name.


Code

String directoryName = "D:\\Osama_Stuff";


File fl = new File (directoryName);


String[] fileList = fl.list();
             
System.out.println("Directory Contains These Files");


     for (int i = 0 ; i < fileList.length ; i++) {
                      
            System.out.println(fileList[i]);
     }

0 comments: