import java.io.*;
import java.util.*;
import java.io.FileWriter;
import java.io.IOException;
public class Dirtrav
{
public static void main(String args[])
{
// String rootDir="C:\\Projects\\PerfBVT'\\W6_TopicVsQueue_8.2.0.0.74_040110\\";
File directory = new File("C:\\Projects\\PerfBVT'\\W6_TopicVsQueue_8.2.0.0.74_040110");
identifydir(directory);
}
//File directory = new File("C:\\Projects\\PerfBVT'\\W6_TopicVsQueue_8.2.0.0.74_040110\\");
public static void identifydir(File di)
{
File[] files = di.listFiles();
if (! di.exists())
{
System.out.println("Invalid path");
return;
}
if (di.isDirectory())
{
for (int i = 0; i < files.length; i++)
{
//Print out the name of files in the directory
//System.out.println(files[index].toString());
System.out.println(files[i]);
if (files[i].isFile())
{
//System.out.println(di);
System.out.println("filefound");
}
di=files[i];
System.out.println("Directory name :"+di.toString());
Generate.generateCsvFile("C:\\resultsexp\\Topic.csv",di.toString());
//
identifydir(di);
}
}
}
}
this code traverse through the directory and sub directory...i need to pass the directory as an input for another program...however here it shows file also as a directory....that leads to an file not found error in the other code ....can anyone please suggest a solution for this problem...thanks in advance