Creating a Single CSV from Multiple CSV's with some adjustments
I am writing an application to check the last modified date on two files for a large number of remote locations. I have a batch file at each location that creates a csv with the following information:
Code:
1111 //location ID//
08/03/2011 01:37 PM <DIR> Python27 //first file checked//
06/01/2011 12:18 PM 44 ip.txt //second file checked//
Just as a note, this is an example, I'm not actually checking those two file names. The location ID is based on a variable and will be different for each location.
THE PART I NEED TO DO IN JAVA:
I am writing an interface where you select a folder containing lets say 100 of these text files and I first want to make a single CSV out of all of them with the following format:
Code:
1111,08/03/2011,06/01/2011
I have found several threads on how to combine CSV files, but it just merges them. I need to read each CSV and take only a piece of the data from the lines and create a new CSV based on the data in them. I think I could potentially use a String Tokenizer to do this but I am not sure. Also as a note I am creating a swing interface for this program so the directory would be selected with a dialogue box and then once selected it would read the directory and create the new CSV. The part of the code where I select the dialogue is below. If this doesn't make sense or more details are needed please let me know and I will respond. I am new to Java and so I may be totally missing something.
Code:
public void actionPerformed(ActionEvent evt) {
Object source = evt.getSource();
if (source == load) {
int returnVal = comb.showDialog(BackupCheck.this, "Make CSV");
comb.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);