private static final String ROOT_FILE_PATH="/"; File f=new File(ROOT_FILE_PATH); File[] allSubFiles=f.listFiles(); for (File file : allSubFiles) { if(file.isDirectory()) { System.out.println(file.getAbsolutePath()+" is directory"); //Steps for directory } else { System.out.println(file.getAbsolutePath()+" is file"); //steps for files } } Sergio
- 3.4k
- 6
- 35
- 51