That worked thanks alot. Another question, I need to carry over the last modified date from the from file and update the last modified date in the to file. How can I do that?
I tried doing this but it did not work. nfd is the input file, opf is the output. I need the last modify date on the from file to carry over when it is written to the new file.
if (returnFlag.equals("Y")) { File opf = new File(subDirName + "\\" + fCurrent.getName()); opf.setLastModified(nfd.lastModified()); FileOutputStream fos = new FileOutputStream(opf); //File opf = new File(subDirName + "\\" + fCurrent.getName());
FileWriter fw = new FileWriter(opf); while ((bytes_read = fis.read(buffer)) != -1) fos.write(buffer, 0, bytes_read); fis.close(); fos.close(); count++;