[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

Creating directory using java ?


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
Ramesh4u
Asked:
Ramesh4u
2 Solutions
 
objectsCommented:
new File(dirname).mkdir();
0
 
mmuruganandamCommented:
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
 
illusionz70Commented:
try this..

String dirname = "your directory name"
File dir = new File(dirname);
  if(!dir.exists() )
         {
      dir.mkdirs();
            }
      
0
 
Ramesh4uAuthor Commented:
would mkdir works for all the operating system?
0
 
mmuruganandamCommented:
Yes... It will work for every operating system
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now