Results 1 to 3 of 3
  1. #1
    yellowfire7 is offline Member
    Join Date
    Oct 2009
    Posts
    3
    Rep Power
    0

    Default Create a folder within a java program.

    I currently have a large file that I want to seperate into (20) different files, which are then seperated by different criteria into more (3+) files. As you can see, this results in over 80 files in one place. If I could, I would like to seperate these files into folders for organization.

    The reading and writing runs fine, the only problem is that I have no idea how to create folders without manually creating them beforehand. Is there any way to do this within the program?

    If it matters, this is in command prompt in JCreator. I am using a Scanner and a BufferredWriter.

    If this is in the wrong place or has been answered already, sorry; I'm new, and I couldn't find the topic elsewhere.

  2. #2
    literallyjer is offline Member
    Join Date
    Oct 2009
    Posts
    25
    Rep Power
    0

    Default

    A directory (or folder) is simply a file that points to another list of files. Thus, if you look at the java.io.File API, you will see methods like isDirectory() and mkdir().

    So, to create a directory...

    Java Code:
    File f = new File("c:\newfolder");
    f.mkdir();

  3. #3
    yellowfire7 is offline Member
    Join Date
    Oct 2009
    Posts
    3
    Rep Power
    0

    Default

    Oh, thanks. I didn't know that a folder was a file of files.

Similar Threads

  1. code to create a folder in java
    By radhika123 in forum New To Java
    Replies: 7
    Last Post: 07-21-2011, 12:21 PM
  2. How to create an access folder for a project in the Jboss server
    By satya kishore in forum Web Frameworks
    Replies: 0
    Last Post: 02-09-2009, 01:31 PM
  3. Replies: 2
    Last Post: 11-21-2008, 06:59 PM
  4. How to create Folder View
    By jazz2k8 in forum Advanced Java
    Replies: 2
    Last Post: 10-24-2008, 03:04 PM
  5. How to create folder(s) and store data?
    By Grom in forum New To Java
    Replies: 2
    Last Post: 08-20-2008, 10:01 AM

Posting Permissions

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