Return to Snippet

Revision: 34542
at October 24, 2010 20:35 by khaled012


Initial Code
package com.asset.jupiter.testing.testEJB;




import java.io.File;
/**
 * @Author:Khaled Talaat
 */
public class FilesReader {
    
    public FilesReader() {
    }
    
    public static void main(String[] args){
        FilesReader filesReader = new FilesReader();
        String path = "D:\\Jupiter\\Documentation\\Core\\samples";
        filesReader.searchFolders(new File(path));
        System.out.println("Done");
    }

    public void searchFolders(File file) {
        if(file.isDirectory()){
            String internalNames[] = file.list();
            for(int i=0; i<internalNames.length; i++){
                searchFolders(new File(file.getAbsolutePath() + "\\" + internalNames[i]));
            }
        } else {
            String[] splitted =  file.getName().split(".java");
            System.out.println(splitted[0]);
        }
    }
}

Initial URL

                                

Initial Description

                                

Initial Title
Iterate over a files in a directory

Initial Tags

                                

Initial Language
Java