Solved

create a directory

Posted on 2004-08-23
5
279 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java 1603 Error 3 50
groupSum6 challenge 6 77
reasons why a "inside Menu" would not appear for a web server 6 56
how do i compare an object based on two fields 6 49
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now