Skip to content

Instantly share code, notes, and snippets.

@skavyas
Created December 12, 2016 05:43
Show Gist options
  • Save skavyas/d6e97d6e8b83d04db6f307d3a0134bad to your computer and use it in GitHub Desktop.
Save skavyas/d6e97d6e8b83d04db6f307d3a0134bad to your computer and use it in GitHub Desktop.
DirectoryScanner scanner = new DirectoryScanner();
scanner.setIncludes(new String[] { "/home/y/heimdall/data/projects/yamas2/dh/complete/yamasraw/yamasBatch/201612080700/0.0.1/*20161212052*.avro" });
//log.info("Data:\n " + dir + fiveMinFolder + "/0.0.1/*/*" + avroFile + "*.avro");
scanner.setCaseSensitive(false);
scanner.scan();
scanner.setErrorOnMissingDir(false);
ArrayList<String> files = new ArrayList<String>();
if (scanner.getIncludedFilesCount() > 0) {
files.addAll(new ArrayList<String>(Arrays.asList(scanner.getIncludedFiles())));
log.info("number of files :"+files.size());
log.info("Files :"+files);
}
String[] pathArr = new String[files.size()];
String[] pathAvro = new String[files.size()];
pathArr = files.toArray(pathArr);
int i=0;
for(String arr:pathArr){
String p = "file:///".concat(arr);
pathAvro[i] = p;
i++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment