title: Mapping name from .txt to a folder in java
body: <p>I have a folder called attachment which contains 5 .gif images and i have a att.txt which contains name for this .gif images, Now i need to rename these images with the name present in att.txt.
  Below is the code i tried.Please help</p>
  
  <pre><code>public static void main(String[] args) throws java.lang.Exception {
      java.io.BufferedReader br = new java.io.BufferedReader(new FileReader("D:\\template_export\\template\\attachments"));
      String sCurrentLine="";
      while ((sCurrentLine = br.readLine()) != null) {
           sCurrentLine= sCurrentLine.replaceAll("txt", "gif");
           String[] s = sCurrentLine.split(",");
           for(int i=0;i&lt;s.length;i++){
               new File("D:\\template_export\\template\\attachment_new"+s[i]).mkdirs();
               System.out.println("Folder Created");
           }
      }
  }
  </code></pre>