Re: IO: creating dirs/files...
maya wrote:
at work I build rather large websites from scratch...
I figured, just for the hell of it, why not write a java class that
creates the dirs and the files that go inside the dirs??? (this would
be locally, I develop in Weblogic localhost..) so am talking about a
stand-alone class...
first thing I notice in API (1.4) is that mkdir() method doesn't take
any params, how do you tell it what to name the dir??
File folder = new File(directoryName);
folder.mkdir();
IMHO, it's unfortunate that Sun chose the name "File"
for this class. It's really not a representation of what
we think of as a file in the file system, but of a name
that might be used to denote a file, and the discrepancy
leads to confusion.
`new File(directoryName)' doesn't "create a file" in
the file system; it just "creates a File object" in your
program, a File object that holds a name that might (or
might not) be the name of an actual file. Then the mkdir()
method tries to create an actual directory using that name.
Other methods can create ordinary data files, delete files
or directories, list the contents of directories, and so on.
But File itself is really just a holder for a name.
--
Eric Sosman
esosman@ieee-dot-org.invalid