I have multiple files that start as CUSTOMER_YYYYMMDD.csv
(each file has its own date) in a folder that consists of many other files. My script (that uses BufferedReader
) already can read data from one concrete file, but I want to get data from files only named as CUSTOMER_YYYYMMDD.csv
, but there is nothing on my mind how to do that.
Here's what I've got:
public static void main(String[] args)
{
BufferedReader br = null;
try {
String line;
br = new BufferedReader(new FileReader("/Users/ovshievb/Desktop/IP/data/tcos/INPUT/CUSTOMER_20150401.csv"));
//Nacita hlavicku CSV failu aby ji preskocit
br.readLine();
// Cteni failu radek po radku
while ((line = br.readLine()) != null) {
// System.out.println("Raw CSV data: " + line);
System.out.println("Customer: " + csvToArray(line) + "\n");
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (br != null) br.close();
} catch (IOException exception) {
exception.printStackTrace();
}
}
}