1 Reply Latest reply: Mar 27, 2007 6:03 AM by 800649 RSS

    Copy a folder kept inside a jar file to a destination

    807599
      Could anyone please tell me how do I copy a folder containing many files kept inside a jar file into a destination. My following code works fine for a single file.
      InputStream is=getClass().getResourceAsStream("/inputs/folder/1.txt");
      File DirPath=new File("D:\\folder");
      if(!DirPath.exists());
           DirPath.mkdirs();                
      File DestPath=new File("D:\\folder\\1.txt");
      FileOutputStream fos1 = new FileOutputStream(DestPath);
      int b1;
      while((b1 = is1.read()) != -1) 
      {
           fos1.write(b1);
      }
      fos1.close();