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++) {
for (int i = 0 ; i < fileList.length ; i++) {
System.out.println(fileList[i]);
}
0 comments:
Post a Comment