Skip to main content
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   }  } 
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   }  } 
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 } } 
Source Link

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 } }