Answers for "how to get the folder from a file in java"

2

java get files in directory

File folder = new File("/Users/you/folder/");
File[] listOfFiles = folder.listFiles();

for (File file : listOfFiles) {
    if (file.isFile()) {
        System.out.println(file.getName());
    }
}
Posted by: Guest on April-08-2021

Code answers related to "how to get the folder from a file in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language