?
Solved

Creating directory using java ?

Posted on 2004-03-30
7
Medium Priority
?
385 Views
Last Modified: 2010-03-31

Could anyone tell me how to create a directory structure in my local drive ( I am using Unix stataion ) using java program.

Thanks

Ramesh
0
Comment
Question by:Ramesh4u
[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
7 Comments
 
LVL 92

Accepted Solution

by:
objects earned 100 total points
ID: 10720818
new File(dirname).mkdir();
0
 
LVL 9

Assisted Solution

by:mmuruganandam
mmuruganandam earned 100 total points
ID: 10720912
You can create a directory as suggested by Objects.

If you want to create one or more directories at one shot,

then

File file = new File(path);
file.mkdirs();


This way you can create all the directories at one shot.



Regards,
Muruga
0
 
LVL 4

Expert Comment

by:illusionz70
ID: 10721296
try this..

String dirname = "your directory name"
File dir = new File(dirname);
  if(!dir.exists() )
         {
      dir.mkdirs();
            }
      
0
 

Author Comment

by:Ramesh4u
ID: 10721306
would mkdir works for all the operating system?
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721312
Yes... It will work for every operating system
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month9 days, 14 hours left to enroll

762 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