Last active
June 7, 2017 09:31
-
-
Save vorobeij/c4896b2ba74dcd2edf0be28608b86bcd to your computer and use it in GitHub Desktop.
get all text files in folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static List<File> getFilesInFolder(String path) { | |
| List<File> files = new ArrayList<>(); | |
| File folder = new File(path); | |
| File[] listOfFiles = folder.listFiles(); | |
| for (int i = 0; i < listOfFiles.length; i++) { | |
| if (listOfFiles[i].isFile()) { | |
| files.add(listOfFiles[i]); | |
| } else if (listOfFiles[i].isDirectory()) { | |
| System.out.println("Directory " + listOfFiles[i].getName()); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment