This function takes a file path, then checks whether is it a folder or not. if it is a folder then finds all files under it. It also checks is the file hidden or not and the file format. Here i checked text (.txt) file.
private void findFileFromFolder(java.io.File file){
if (file.isDirectory()){
java.io.File subFile[] = file.listFiles();
for (int i = 0; i < subFile.length; i++){
if (subFile[i].isDirectory()){
this.findFileFromFolder(subFile[i]);
} else {
if (!subFile[i].isHidden() && this.isExtension(subFile[i], "txt")) {
this.doFileProcess( );
}//if
}//else
}//for
} else {
this.doFileProcess( );
}
}
private void doFileProcess( ){
/// todo: add your file code
}