I would like to overwrite the file if it exists. I am writing to a csv file and I dont want to append to it but rather overwrite the file if it matches the name exactly.
How would I modify it?
Date now = new Date();
formatter = new SimpleDateFormat("MMddyyyy");
s = formatter.format(now);
outputFile = "C:\\Files\\NJ" + s +".CSV";
// Error catching.
File file = new File( outputFile );
fileExists = file.exists();
out = new FileWriter( outputFile, true );
session.log( "Writing data to a file." );