Results 1 to 8 of 8
  1. #1
    radhika123 is offline Member
    Join Date
    Apr 2008
    Posts
    4
    Rep Power
    0

    Default code to create a folder in java

    Hi friends
    I want to know how to create a folder in java using files concept.
    Can any one send me the code to create a folder in our system using files concept.
    Thanks in advance

  2. #2
    sdileepk is offline Member
    Join Date
    Jul 2008
    Posts
    6
    Rep Power
    0

    Default

    In the Java.io.file package you have a mkdir method which is used to create a directory. I dont remember how this is exactly used but iam sure that it can be created with this method.

  3. #3
    sdileepk is offline Member
    Join Date
    Jul 2008
    Posts
    6
    Rep Power
    0

    Default

    Hey radhika here is the sample code. i think this should work for you. Am not sure as i have not tested as te system from which am accessing the forum from the cyber cafe. please let me know if any chnages are made in this to compile.

    File f = new File("C:\TEST");
    try{
    if(f.mkDir())
    System.out.println("Directory Created");
    else
    System.out.println("Directory is not created");
    }catch(Exception e){
    e.printStacktrace();
    }

  4. #4
    Laxmikant1 is offline Member
    Join Date
    Mar 2009
    Posts
    1
    Rep Power
    0

    Default code to get name of transferred file from client to serverside

    I am trying Socket programming. Can I get code to get name & type of transferred file from client to serverside....

  5. #5
    Join Date
    Apr 2010
    Posts
    2
    Rep Power
    0

    Default

    how do you delet the folder from the program ?

  6. #6
    sachinmani is offline Member
    Join Date
    Jul 2011
    Posts
    1
    Rep Power
    0

    Default

    try this code

    File f1 = new File(file);
    boolean success = f1.delete();

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Guys, please use code tags when you are posting code segments in the forum. Unformatted codes are really hard to read. :)

  8. #8
    chipp's Avatar
    chipp is offline Member
    Join Date
    Jul 2011
    Posts
    62
    Rep Power
    0

Similar Threads

  1. How to create directory through Java Code
    By Java Tip in forum java.io
    Replies: 1
    Last Post: 04-14-2009, 03:34 PM
  2. folder cloning
    By jad in forum Advanced Java
    Replies: 1
    Last Post: 07-01-2008, 12:28 AM
  3. Creating a java gui to create xml code
    By Jman in forum New To Java
    Replies: 3
    Last Post: 04-27-2008, 06:56 PM
  4. add password to folder
    By ismailsaleh in forum AWT / Swing
    Replies: 1
    Last Post: 01-08-2008, 05:46 AM
  5. creation of new folder in the mail
    By an8086 in forum Advanced Java
    Replies: 1
    Last Post: 07-15-2007, 05:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •