Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

create a directory

Posted on 2004-08-23
5
Medium Priority
?
298 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

718 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