This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Creating New Folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Creating New Folder" Watch "Creating New Folder" New topic
Author

Creating New Folder

Jacob Steingart
Ranch Hand

Joined: Mar 28, 2008
Posts: 63
If you are creating, say, a text file called "file.txt" and you set the path to "folder/text" will the folder "folder" be created?

[EDIT] Never mind I figured it out


I never know what to put in my signature...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36579
    
  16
Don't know. Have you tried it?
Jacob Steingart
Ranch Hand

Joined: Mar 28, 2008
Posts: 63
Indeed I did, but alas, it didn't work. i'm still searching around to figure out how to make a folder. I'm trying to make a data storage thingy (that's what the professionals call it :P) that I can use for different programs. My basic plan is to have a single copy of this "data storage thingy" running on one computer. Any software that needs to use it could just dial it up with java.net and tell it to do something, i.e. make a table, make a 3d array, store a bit array, get some info, etc. It will be an interesting project, though useful.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

The methods "mkdir()" (create a single directory) and "mkdirs()" (create a nested chain of directories) in java.io.File are the way to create "folders" in Java.


[Jess in Action][AskingGoodQuestions]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Creating New Folder
 
Similar Threads
Java Trees and Map
HTTP Status 404 - /Beer-v1/form.html
how to create files in src folder in java
Deploying using war file using in other folders
How to access a text file inside a JAR