Skip to content

Instantly share code, notes, and snippets.

@pete2786
Last active December 30, 2015 07:29
Show Gist options
  • Save pete2786/7796676 to your computer and use it in GitHub Desktop.
Save pete2786/7796676 to your computer and use it in GitHub Desktop.
public class Filewalker {
public void walk( String path ) {
File root = new File( path );
File[] list = root.listFiles();
if (list == null) return;
for ( File f : list ) {
if ( f.isDirectory() ) {
// Might want to do something here, set a variable to track which folder
// you are currently in or something to use later for storing in the meta data tables
walk( f.getAbsolutePath() );
}
else {
//Grab the file name to pass to the function for inserting report name into table, may also
// want to run it through a santizer to convert stuff like the %256 -> :
String report_name = f.getName();
//Pass the file path to the parser, might need to just use the the ReadXMLFile_report.java
// class, instantiate that and pass the report name and file path to be parsed.
saxParser.parse(f.getAbsoluteFile());
}
}
}
public static void main(String[] args) {
String webcatalog_root = "c:\\" // TODO: Change to a command line arg or setting
Filewalker fw = new Filewalker();
fw.walk(webcatalog_root);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment