Posts

Showing posts from July, 2015

How to append Same File name With Date Append in Java?

Please Find Code Below : ==================Append.java======================= import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.util.Date; /**  *  * @author ananddw  */ public class Append {     public static void main(String[] args) throws IOException {         /*          Date date = new Date();         File file1 = new File("/home/ananddw/Anand.json");         String file2 = file1.getParent().toString();         System.out.println("file 2 call ===>" + file2);         boolean b = false;         if (!(file1.exists())) {             b = file1.createNewFile();         }         if (b) {             System.out.println("Empty File successfully created");         } else {             String fileContent = "";               String filename = file1.toString() + date;             try {                 File f =