aspose file tools
The moose likes Java in General and the fly likes how to creat a directory? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "how to creat a directory?" Watch "how to creat a directory?" New topic
Author

how to creat a directory?

Maha Hassan
Ranch Hand

Joined: Aug 02, 2005
Posts: 133
Dear All
i want to creat a directory and then add a file to it
well i know how to creat a file
File test = new File (file path);
and i know to test wheather or not this is a directory
BUT!! how to CREAT a directory in the first place
please help me
thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35443
    
    9
Check out the File.mkdir() and File.mkdirs() methods; they create one directory or a hierarchy of directories, respectively.


Android appsImageJ pluginsJava web charts
Maha Hassan
Ranch Hand

Joined: Aug 02, 2005
Posts: 133
both are boolean
i want to set the file to a directory
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24081
    
  15

Read the documentation: they create a directory, and return true or false to indicate success.


[Jess in Action][AskingGoodQuestions]
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3011
    
    9
Originally posted by Maha Aburahma:
well i know how to creat a file
File test = new File (file path);


This does not create a file.
It creates a File object that represents an operating system file, but that file will not be created by this call.


Joanne
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: how to creat a directory?
 
Similar Threads
in jsp file ,object of java file not created
in jsp file ,object of java file not created
Method calling
Axis error: java.io.FileNotFoundException
how i creat a xls File in Frame