Do u know how to write a few line of codes to create folder?

hi all, I just need a few line of codes to create a folder in my directory. Can someone just write a few lines of codes to create a folder?Thanks!
This is my unzip codes and I need to put these few lines of codes in the "/* */" part. If I didn't create the folder (using codes)then it would not be unzipped.
import java.io.*;
import java.util.*;
import java.util.zip.*;
public class Unzip {
  public static final void copyInputStream(InputStream in, OutputStream out)
  throws IOException
    byte[] buffer = new byte[1024];
    int len;
    while((len = in.read(buffer)) >= 0)
      out.write(buffer, 0, len);
    in.close();
    out.close();
  public static final void main(String[] args) {
    Enumeration entries;
    ZipFile zipFile;
    try {
      zipFile = new ZipFile("C:\\Temp\\FolderZiper.zip");
      entries = zipFile.entries();
      while(entries.hasMoreElements()) {
        ZipEntry entry = (ZipEntry)entries.nextElement();
/*need to have the few lines of codes here*/
        if(entry.isDirectory()) {
          // Assume directories are stored parents first then children.
          System.err.println("Extracting directory: " + entry.getName());
          // This is not robust, just for demonstration purposes.
          (new File(entry.getName())).mkdir();
          continue;
        System.err.println("Extracting file: " + entry.getName());
        copyInputStream(zipFile.getInputStream(entry),
           new BufferedOutputStream(new FileOutputStream(new File("c:\\temp\\unzipping\\"+entry.getName()))));
      zipFile.close();
    } catch (IOException ioe) {
      System.err.println("Unhandled exception:");
      ioe.printStackTrace();
      return;
}

Given a file, you can create its parent directory like this:
File outFile = new File("c:\\temp\\unzipping\\"+entry.getName())
File parentDir = outFile.getParentFile();
if (!parentDir.exists()){
  parentDir.makeDirs();
}Not too hard is it?

Similar Messages

  • How many new tax type and tax code  are created for change in TDS

    Hello Gurus.
    we are using SAP since more than  one year.
    now tDS rate is change , so i would like to know How many new tax type  and Tax Code is created in our system
    and also like to know At what percentage  i will crete that  new tax code.
    we have pair of tax type and tax code as shown in Example( for Interest) below
    Tax type        Tax code           Name
    I1      IC      Sec 194A - Interest on deposits
    I1      IO      Sec 194A - Interest on deposits OT
    I2      IC      Sec 194A - Interest on deposits Surcharg
    I3      IC      Sec 194A - Interest on deposits EC& SHEe
    I3      IO      Sec 194A - Interest on deps EC& SHEe OT
    I4      IC      Sec 194A - Interest on deposits Pymt
    I4      IO      Sec 194A - Interest on deposits Pymt OT
    I5      IC      Sec 194A - Interest on dep Pymt Surcharg
    I6      IC      Sec 194A - Interest on dep Pymt EC& SHEe
    so  how namy  additional  reuire to create new tax type and code more.
    i am waiting your reply.
    Regard,
    Riten patel
    Edited by: riten patel on Oct 29, 2009 10:23 AM
    Edited by: riten patel on Oct 29, 2009 10:23 AM
    Edited by: riten patel on Oct 29, 2009 10:33 AM

    Hello Hansachechani
    we have  followinng   tax key
    115O     Dividend 115O(1)
    192B     Salary
    194A     Interest income other than securities
    194C     Payment to contractors
    194H     Commission
    194I     Rent
    194J     Prof/Technical services
    195     Payment to foreign nationals
    206C     Tax Collected at Sources (Scrap)
    ST     Service Tax
    and we have followig tax type
    C4     Sec 194H Commission Payment
    C5     Sec 194H Commission Pymt Surcharge
    C6     Sec 194H Commission Pymt EC & SHE Cess
    D4     Sec 115O(1) Dividend Payment
    D5     Sec 115O(1) Dividend Pymt Surcharge
    D6     Sec 115O(1) Dividend Pymt EC & SHE Cess
    F4     Sec 195 Foreign Prof fees Payment
    F5     Sec 195 Foreign Prof fees Pymt Surcharge
    F6     Sec 195 Foreign Prof Fees Pymt E&HS Cess
    G1     Service Tax on GTA
    G2     Service Tax on GTA E Cess
    G3     Service Tax on GTA S&HE Cess
    I4     Sec 194A Int on Deposit Payment
    I5     Sec 194A Int on Deposit Pymt Surcharge
    I6     Sec 194A Int on Deposit Pymt EC & SHE Ce
    L4     Sec 194C Contractors Payment
    L5     Sec 194C Contractors Payment Surcharge
    L6     Sec 194C Contractors Payment EC&S HE Ces
    P4     Sec 194J Professional Payment
    P5     Sec 194J Professional Pymt Surcharge
    P6     Sec 194J Professional Pymt EC & SH E Ces
    R4     Sec 194I Rent Payment
    R5     Sec 194I Rent Payment Surcharge
    R6     Sec 194I Rent Payment E Cess & SH E Cess
    So Is it necessary to create new tax key and tax type?
    wheather i create new tax code only?
    I ma waiting your reply.
    Regard,
    Riten patel

  • I Want to make an app.. but i dont know how to write code or use Xcode... where I can begin?

    Hey!
         I just graduate from high school.. im gonna study Computer Enginnering. Im working for my family and they need an app that works like iBook. We have the eBooks and then they want me to do an app where they can sell the eBooks and read them. I have Xcode, but I dont know how to write codes or where to begin in all of this. I want to make the app first for iPad but if it can be for both iPad and iPhone better. I just want recommendation and help. Please and Thanks!! 

    hello i hope your having a good day but can you reply to me if you got the codes to make an app because i want to make an app too  thanks

  • (I can't compile it .I don't know how to write constructor in Initial Class

    All class and main program is OK except the inital class.
    Author Class
    class Author {
    private String authorName;
    private Initials inits;
    private int numTitles = 0;
    // PRE True POST Prompts user for details
    // and RETURNS new Author constructed from details
    public Author(BufferedReader in) {
    System.out.print("\nSurname ==> ");
    authorName = Text.ReadString(in);
    inits = new Initials(in);
    numTitles = 0;
    // PRE TRUE
    // POST RETURNS String representation of Author
    public String toString() {
    String result;
    result = "NAME : " + authorName + " " + inits.toString() + "\n";
    result = result + "Number of titles is " + numTitles;
    return(result);
    // PRE TRUE
    // POST Increments number of titles
    public void incTitles() {
    numTitles++;
    Book Class
    public class Book {
    private String title;
    private Author author;
    // PRE TRUE // POST Prompts user for details
    // and RETURNS new Author constructed from details
    public Book(Author author, BufferedReader in) {
    System.out.print("\nTitle ==> ");
    title = Text.ReadString(in);
    this.author = author;
    author.incTitles();
    // PRE TRUE
    // POST RETURNS String representation of Book
    public String toString() {
    String result;
    result = "TITLE : " + title + "\n";
    result = result + "AUTHOR\n" + author.toString() + "\n";
    return(result);
    *****Initial Class (I can't compile it . I don't know how to write constructor
    class Initials
    {   private char[] inits;
         public Initials(BufferedReader in)
         System.out.print("\nInitails Testing ==> ");
         inits = Text.ReadString(in);
         public String toString()
              String result;
              result="Testing";
              return(result);
    Main program
    public class BookMain {
    static private BufferedReader in = new BufferedReader(new                                    InputStreamReader(System.in));
    public static void main(String[] args) {
    Author authorRec1, authorRec2;
    Book bookRec1, bookRec2;
    System.out.println("\n\n****** First author input");
    authorRec1 = new Author(in);
    System.out.println("\n\n****** First author output\n" + authorRec1.toString());
    System.out.println("\n\n****** Second author input");
    authorRec2 = new Author(in);
    System.out.println("\n\n****** Second author output\n" + authorRec2.toString());
         System.out.println("\n\n****** First book input");
    bookRec1 = new Book(authorRec2, in);
    System.out.println("\n\n****** First book output\n" + bookRec1.toString());
    System.out.println("\n\n****** Second book input");
    bookRec2 = new Book(authorRec2, in);
    System.out.println("\n\n****** Second book output\n" + bookRec2.toString());
    System.out.println("\n\n****** First book output\n" + bookRec1.toString());

    Change this
    class Initials {
    private char[] inits;
    to this
    class Initials {
    private String inits;
    import java.io.*;
    public class BookTest {
      static private BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      public static void main(String[] args) {
        Author authorRec1, authorRec2;
        Book bookRec1, bookRec2;
        System.out.println("\n\n****** First author input");
        authorRec1 = new Author(in);
        System.out.println("\n\n****** First author output\n" + authorRec1.toString());
        System.out.println("\n\n****** Second author input");
        authorRec2 = new Author(in);
        System.out.println("\n\n****** Second author output\n" + authorRec2.toString());
        System.out.println("\n\n****** First book input");
        bookRec1 = new Book(authorRec2, in);
        System.out.println("\n\n****** First book output\n" + bookRec1.toString());
        System.out.println("\n\n****** Second book input");
        bookRec2 = new Book(authorRec2, in);
        System.out.println("\n\n****** Second book output\n" + bookRec2.toString());
        System.out.println("\n\n****** First book output\n" + bookRec1.toString());
    class Author {
      private String authorName;
      private Initials inits;
      private int numTitles = 0;
      // PRE True POST Prompts user for details
      // and RETURNS new Author constructed from details
      public Author(BufferedReader in) {
        System.out.print("\nSurname ==> ");
        authorName = Text.ReadString(in);
        inits = new Initials(in);
        numTitles = 0;
      // PRE TRUE
      // POST RETURNS String representation of Author
      public String toString() {
        String result;
        result = "NAME : " + authorName + " " + inits.toString() + "\n";
        result = result + "Number of titles is " + numTitles;
        return(result);
      // PRE TRUE
      // POST Increments number of titles
      public void incTitles() {
        numTitles++;
    class Book {
      private String title;
      private Author author;
      // PRE TRUE // POST Prompts user for details
      // and RETURNS new Author constructed from details
      public Book(Author author, BufferedReader in) {
        System.out.print("\nTitle ==> ");
        title = Text.ReadString(in);
        this.author = author;
        author.incTitles();
      // PRE TRUE
      // POST RETURNS String representation of Book
      public String toString() {
        String result;
        result = "TITLE : " + title + "\n";
        result = result + "AUTHOR\n" + author.toString() + "\n";
        return(result);
    class Initials {
      private String inits;
      public Initials(BufferedReader in) {
        System.out.print("\nInitails Testing ==> ");
        inits = Text.ReadString(in);
      public String toString() {
        String result;
        result = inits;
        return(result);
    class Text {
      static String ReadString(BufferedReader in) {
        String text = "";
        try {
          text = in.readLine();
        catch (IOException e) {
          System.out.println(e.getMessage());
          System.exit(0);
        return text;
    }

  • Does anybody know how to write GUI for J2ME?

    Does anybody know how to write GUI for J2ME?
    Thanks!

    Hi..! I don't know exactly... it's a good question. I refered something. U visit below URL's.
    http://www.java-pro.com/upload/free/features/javapro/2000/13iss00/rg0013/rg0013.asp
    http://developer.java.sun.com/developer/technicalArticles/wireless/midpui/

  • I dont know how to write an e-mail to HP Support

    I dont know how to write an e-mail to HP Support, I stuck on this page and dont know what should i do next.
    The following information was returned for your product
    Serial number 5*******44
    Product number LQ*****#***
    Warranty StatusCovered under warranty
    Warranty Category Factory Warranty
    Warranty End Date 2012-05-27 (YYYY-MM-DD)
    The following online support options are available to you
    Consumer support forum
     Call technical support after you buy (Out-of-warranty customers may pay a fee)
    The result displayed is solely based on information available to HP. The legal warranty expiration date is based on the date of purchase as indicated on your receipt. This date might differ from the results shown.
    If the displayed result is not correct please contact an HP Technical Support Technician for further assistance.

    You are best to use Chat (USA only), or call HP on the phone about warranty concerns, they get too many emails and yours may not get read by the right person.
    USA
    http://welcome.hp.com/country/us/en/contact_us.html
    Everywhere else
    http://welcome.hp.com/country/us/en/wwcontact_us.html

  • Anyone knows how to write WBMP image ??? please help !

    hi all,
    anyone knows how to write WBMP image, please show me !
    thanks.

    http://www.google.com/search?q=wbmp
    Please do not create additional posts, just refresh ("bump") the original.

  • Want to know how to check for new line character in text file

    Hi All,
    I`m trying to read data from text file. However I`m not sure whether the data is in 1st line or nth line. Now I`m trying to read the text from the readline. But if text is "" and not NULL then my code fails. So I want to know how to check for new line character and go to next line to find the data. Please help.
    Thanks
    static int readandwriteFile(Logger logger,String filepath){
              BufferedWriter out = null;
              BufferedReader in = null;
              File fr = null;
              int get_count = 0;
              try     {
              if(new File(filepath).exists())
              fr= new File(filepath);
                        System.out.println("FileName: "+fr);
                   if(fr != null){
    in = new BufferedReader(new FileReader(fr));
                             String text = in.readLine();
                             if(text != null){
                             get_count = Integer.parseInt(text);
                             in.close();
                             else{
                                  get_count = 0;
         else{                    
    out = new BufferedWriter(new FileWriter(filepath));
         out.write("0");
                out.close();
                   }          //Reading of the row count file ended.
              catch(Exception e) {
                   e.printStackTrace();
              finally {
                   try{               if (in != null) {
                             in.close();
              if (out != null) {
                             out.close();
              catch(Exception e) {
                        e.printStackTrace();
              return get_count;
         }

    You are calling the readline() only once which means you are reading only the first line from the file...
    Use a loop (Do-While preferably)
    do{
    //your code
    }while(text == "")

  • Does Anyone know how to add a new partner to purchase order created on VI01/VI02?

    Does Anyone know how to add a new partner to purchase order created on VI01/VI02?
    Please, anyone knows that?
    Regards.
    Rafael.

    Anyone?

  • Does anyone know how to get a white line across text like the USA basketball logo?

    does anyone know how to get a white line across text like the USA basketball logo?

    Draw the shape which is to be knocked out (a line in the example) in a layer above the logo. The colour doesn't matter because it will be made invisible.
    Double-click in the space to the right of the layer's name in Layers panel to open its Layer Style window where advanced blending can be modified.
    Set Fill Opacity to zero and Knockout to "Deep" or "Shallow" depending on whether the knockout should be limited to a containing Group.

  • How to know how much size we need in a tablespace to create index

    Hi,
    can anybody plz let me know,
    how to know how much space i need in a tablespace to create an index.
    thanks in advance

    Estimate Index Size and Set Storage Parameters
    http://www.camden.rutgers.edu/HELP/Documentation/Oracle/server.815/a67772/indexa.htm#388
    Estimating Bitmap Index Size
    http://download.oracle.com/docs/cd/A87860_01/doc/server.817/a76992/ch6_acce.htm#3625
    HTH
    Girish Sharma

  • Enyone know how to get USB stick back to normal after creating a USB boot disk for Mavericks?

    Enyone know how to get USB stick back to normal after creating a USB boot disk for Mavericks? https://discussions.apple.com/message/23527458#23527458

    You should just be able to erase it using Disk Utiilty. I did with my 8Gb.
    If not I have a USB deep format tool, but it only works with Windows: http://tinyurl.com/mwor6s9
    You can download that and unzip it, then run it on a PC to fully erase and format the flash drive. Format it in FAT, and then the Mac will read and mount it so you cna once again format it with HFS extended for Mac use.

  • Please let me know how to write the Query to fetch data from tables

    Hi Folks,
    Please let me know how to get the data from  different tables using the functionality SQ03,SQ02  and SQ01 .
    Helpful answers will points awarded.
    Regards,
    Ram.

    Dear Ram,
    Please find the below link which gives in detail with screen shots.
    [SAP Query|http://media.techtarget.com/searchSAP/downloads/Teach_yourself_SAP_C20.pdf#search=%22CREATE%20REPORT%20USING%20SQVI%20%2C%20SAP%22]
    Thanks
    Murtuza

  • Does anyone know how to write on a NTFS drive?

    Re: question???
    How to write to a NTFS drive??
    Maybe native support???

    I got this working just yesterday. Read this link for instructions:
    http://www.offthehill.org/articles/2010/12/31/macfuse-for-64-bit-snow-leopard/
    Install tuxera's MacFUSE binary from here: http://www.tuxera.com/mac/macfuse-core-10.5-2.1.9.dmg
    Once you plug in your USB drive or an NTFS drive, the system will mount it read-only by default. You will need to "umount" it (as root, of course) and re-mount it with read-write permissions and a "noowners" option (I assume you're familiar with Unix commands and their options). I tried this today and it works, I can read/write to the NTFS drive on 64-bit snow leopard.

  • I have downloaded Word in icloud have opened a project named Recipes and added a recipe now I don't know how to write and save another recipe to the same place.  I don't see anyway to save?

    After using the Word in ICloud and creating a new project named recipes then putting a recipe in now I don't know how to add a new page with another recipe and save it to the same  project the first one is in.  I don't see any icon that will save?

    Arlene83 wrote:
    After using the Word in ICloud
    There is no version of the Microsoft Word app available for iPad.  What exactly do you mean here?  What app are you talking about?  And what is the tie-in to iCloud?

Maybe you are looking for

  • How to change screen brightness on bootcamp 5.0.2 in Windows 8?

    I have a retina MacBook Pro which i used bootcamp to install windows 8 on. However, i cannot change the brightness with my F1/F2 key. Any solutions?

  • I phone 4s i messages randomness

    hi.. soem peoepl can send and rec i messages from me fine.. but i know of at least 2 others who can contact me by text only and have to switch off i message to do it   and only rec text messages from me despite my imessage being on..   what settings

  • After recent system updates iPod Crashes G5

    I could not us iPod Updater on that mac since it crashed it every time I would plug into dock. I plugged into my G3 laptop and was able to do reset to factory default, so now when I plug into G5, even though system profiler sees it, it does not go to

  • Matching router & switch L2 settings

    Hi, I need to connect a C3825 router who's config. I can't change who's L2 config is, interface GigabitEthernet0/1 duplex full speed 100 media-type rj45 negotiation auto to a switch model WS-C3560E-48TD-S. Is this the correct config. for this switch

  • Erase And Clean Install Error

    Hi Guys, I'm attempting to reinstall OSX on a Macpro - 10.4.10 using the Erase and Clean Install. All goes well with the first installation disc and all is going well with the second disc until it gets to garageband where it freezes and then stops in