Results 1 to 3 of 3
  1. #1
    Grom is offline Member
    Join Date
    Aug 2008
    Posts
    20
    Rep Power
    0

    Default How to create folder(s) and store data?

    Hello all,

    Fresh to ubuntu and NetBeans.

    I am trying to translate my C# app to Java. You can download NetBeans project (TakeOne.zip, 226 Kb) for better flow. (well this is my 2nd post and I can not post links yet, so I'll try to write the link: www dot beezgetz dot com/NetBeans/TakeOne.zip)

    How can I create a folder(s) and store data in them, for app to use?
    How can I populate tree which should mimic those folders?

    Here is the code I used in C# app to create folders and populate tree:
    Java Code:
    Directory.CreateDirectory("c:/Rigg Them All Projects/" + Form5.novProjekt);
    Directory.CreateDirectory("c:/Rigg Them All Projects/" + newProjectName + "/" + "Grid");
    Directory.CreateDirectory("c:/Rigg Them All Projects/" + newProjectNamet + "/" + "Truss");
     Directory.CreateDirectory("c:/Rigg Them All Projects/" + newProjectName + "/" + "Bridle");
    
    
      //___treeview updates from those folders above
    DirectoryInfo root = new DirectoryInfo("c:/Rigg Them All Projects"); // Our root path, we start here
    treeView1.Nodes.Clear();
    treeView1.Nodes.Add("Rigg Them All Projects");
    this.TreeViewUpdate.ShowNodes(root, treeView1.Nodes[0]);
    treeView1.Nodes[0].Expand();
    If I am not explained good my 'problem', I can explain more. Thank you!

    Kind regards, Grom

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default

    How can I create a folder
    look at the File class. It has a method mkdir that will create a folder

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

    Default

    You have to something like this, in much better way.

    Java Code:
                File temp = new File("temp_folder"); // Folder path
                if(!temp.exists()) {
                    temp.mkdirs();
                }

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. Replies: 16
    Last Post: 05-08-2008, 10:45 PM
  3. Replies: 2
    Last Post: 12-12-2007, 06:01 PM
  4. how to use btree to store data
    By fred in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 06:52 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
  •