aspose file tools*
The moose likes I/O and Streams and the fly likes File.createNewFile(); File.mkdir(); order Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "File.createNewFile(); File.mkdir(); order" Watch "File.createNewFile(); File.mkdir(); order" New topic
Author

File.createNewFile(); File.mkdir(); order

Brusk Baran
Ranch Hand

Joined: Nov 15, 2001
Posts: 132
Hi.
I wonder why the following code does not work!

It just creates a file, but cannot convert the newly created file to a directory structure..
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2851
    
  11

Something can either be a file or directory, not both at the same time. There is no way to convert a file to a directory, short of deleting the file and creating a directory with the same name. What exactly are you trying to accomplish?
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
If you're trying to create a new file, and (some of) the parent directory structure doesn't exist yet, you can try something like:


"I'm not back." - Bill Harding, Twister
 
 
subject: File.createNewFile(); File.mkdir(); order