import java.io.File;
public class Finding {
public static String path = "Not Found";
public static void main(String[] args){
File parent = new File("");
parseAllFiles(parent.getAbsolutePath(), "reports", "pmd-report.csv");
System.out.println("File Path -> " + path);
/*File[] files = File.listRoots();
for(File f : files){
parseAllFiles(f.getPath());
}*/
}
/**
* Finds the absolute path for the given file & directory
* @param parentDirectory
* @param dir
* @param fileName
*/
public static void parseAllFiles(String parentDirectory, String dir, String fileName){
File[] filesInDirectory = new File(parentDirectory).listFiles();
for(File f : filesInDirectory){
if(f.isDirectory()){
parseAllFiles(f.getAbsolutePath(), dir, fileName);
}
if(f.getName().equals(fileName) && f.getParentFile().getName().equals(dir)){
path = f.toString();
}
}
}
}
public class Finding {
public static String path = "Not Found";
public static void main(String[] args){
File parent = new File("");
parseAllFiles(parent.getAbsolutePath(), "reports", "pmd-report.csv");
System.out.println("File Path -> " + path);
/*File[] files = File.listRoots();
for(File f : files){
parseAllFiles(f.getPath());
}*/
}
/**
* Finds the absolute path for the given file & directory
* @param parentDirectory
* @param dir
* @param fileName
*/
public static void parseAllFiles(String parentDirectory, String dir, String fileName){
File[] filesInDirectory = new File(parentDirectory).listFiles();
for(File f : filesInDirectory){
if(f.isDirectory()){
parseAllFiles(f.getAbsolutePath(), dir, fileName);
}
if(f.getName().equals(fileName) && f.getParentFile().getName().equals(dir)){
path = f.toString();
}
}
}
}