Solved

create a directory

Posted on 2004-08-23
5
282 Views
Last Modified: 2010-03-31
I have to create a directory with a specified name.
I am using the following

          boolean success = (new File(createDirName)).mkdirs();
          if (!success) {
           System.out.println("Directory creation failed");
          }


this code fails.
createDirName is a String variable which contains the value E:\del\06-08-2004
E:\del already exists. it just needs to create a directory with the name 06-08-2004. this value can't be harcoded as it is fetched at runtime.
0
Comment
Question by:thomas908
  • 3
  • 2
5 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 11869980
boolean success = (new File(createDirName)).mkdir();
0
 
LVL 8

Author Comment

by:thomas908
ID: 11870004
already tried doesn't help
0
 
LVL 35

Accepted Solution

by:
TimYates earned 100 total points
ID: 11870029
should work (so should yours) assuming you have write permission for the "del" directory...

Ahh...is "E:" not the drive you are running the java app from?

According to this:

http://java.ittoolbox.com/documents/document.asp?i=2633

You need to do something with FileSystemView inside javax.swing.filechooser.* ;
0
 
LVL 8

Author Comment

by:thomas908
ID: 11870056
oops!
My mistake. was doing it wrong.
thanks for helping
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11870072
Glad you got it sorted and thanks for the points!! :-)

Good luck with it :-)

Tim
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jar file executable 12 52
object oriented programming comparison 5 71
more than one jdk and one jre 1 41
oracle 11g 23 82
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question