File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Doubt in directory creation for files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Doubt in directory creation for files" Watch "Doubt in directory creation for files" New topic
Author

Doubt in directory creation for files

vanlalhmangaiha khiangte
Ranch Hand

Joined: Sep 11, 2006
Posts: 170


Is there any way to create this directory without using the mkdir(); ...
I mean if i pass "D:\\try\\cool\\hot\\test.txt"
The directory try ,cool and hot can be automatically created ..


Thanks in advance
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3556
    
  15
Why don't you want to use mkdir ?


Joanne
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41867
    
  63
Note that mkdirs can create a complete directory hierarchy in one step.


Ping & DNS - my free Android networking tools app
vanlalhmangaiha khiangte
Ranch Hand

Joined: Sep 11, 2006
Posts: 170
Hi ,
I have already written some logic so that the file can be created with the directory by using mkdir() ..But I want to know if there is any other API that can create the file and directory by passing the full path name and the file name.
Been googling it but didn't find any ..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41867
    
  63
Well, you already said in your first post that you were looking for something else, but you didn't say why. As long as we don't know why File.mkdir(s) doesn't meet your requirements, it's hard to give any advice.
Vihung Marathe
Greenhorn

Joined: Apr 24, 2006
Posts: 7
I think what the original poster is trying to say is that they want one operation to make the directory and to create the file all in one go.

The answer is no. There is no method in the standard API that will both create the directories and create the file.

Nothing stopping you from creating your own method, though

Something like
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in directory creation for files