bob boyd

Greenhorn
+ Follow
since Sep 05, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by bob boyd

I m trying hard to just have my program look into the specified directory and create a separate file object for each folder the directory contains, there is usually 2 but there could be more. I got that, but i need to keep the files separate so I can pass them to another class down the road to do some stuff. I cant seem to logically think of the way to after the while to write the first file out and then loop back through without overwriting f2 please help. mucho gracias


[This message has been edited by Marilyn deQueiroz (edited September 06, 2001).]
22 years ago
I m trying hard to just have my program look into the specified directory and create a separate file object for each folder the directory contains, there is usually 2 but there could be more. I got that, but i need to keep the files separate so I can pass them to another class down the road to do some stuff. I cant seem to logically think of the way to after the while to write the first file out and then loop back through without overwriting f2 please help. mucho gracias
import java.io.*;
import java.util.*;
class initializer{
static String dir = new String("C:\\Data\\");
public static void main(String[] args){
File f = new File(dir);
String[] files = f.list();
try{
System.out.println("there are " + files.length + " files in the directory");
for (int i = 0;i < files.length;i++)
{
File f2 = new File(dir + files[i]);
Vector temp = new Vector();
BufferedReader br;
String line;
br = new BufferedReader(new FileReader(f2));
line = br.readLine();
while (line != null) {
temp.add(line);
line = br.readLine(); //here we have the needed info, but it needs to be stored!
File[] fIter = f2.listFiles;
//for(int j = 0; j < files.length; j++){
// fIter = new File();}
//File[] fEach = temp.copyInto();
// System.out.println(fEach[j]);}
}//end while
System.out.println(temp);
}
}catch(Exception e){
System.out.println("Exception occured: " + e);
e.printStackTrace();}
}//end main
}//end class
[This message has been edited by bob boyd (edited September 05, 2001).]
[This message has been edited by bob boyd (edited September 05, 2001).]
22 years ago