I want to handle files of same type.For example if am dealing with txt files means i hav to read all the text files once and i should also find a certain keyword(similar keyword) which should exists in all those files.

Anyone suggest how to do that.

Re: handling multiple files 80 80

if you can read one file you can read them all...

Re: handling multiple files 80 80

Tats was great answer i didnt expect. How to take list of files from the folder

File f1 = new File("E:\\backup_javaprog\\New Folder");
FilenameFilter f2= new OnlyExt("text");
String s[]=f1.list(f2);

Was it correct ???

Re: handling multiple files 80 80

Use an array list, and the file api for java. Then read all those files with .txt extensions into the arrayList and away you go.

Re: handling multiple files 80 80
File file = new File(directory);
if (!file.isFile) {
    FilenameFilter filter = .... // that's for you to figure out
    String[] files = file.list(filter);
    ... // now do something with those filenames (which may be directorynames).
commented: Perfect example +5
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.