Java Reference
In-Depth Information
new File("/home/ian/once/twice/again").mkdirs( );
Both variants of this command return true if they succeed and false if they fail. Notice that
it is possible (but not likely) for mkdirs() to create some of the directories and then fail; in
this case, the newly created directories are left in the filesystem.
Notice that the spelling mkdir() is all lowercase. Although this might be said to violate the
normal Java naming conventions (which would suggest mkDir() as the name), it is the name
of the underlying operating system call and command on both Unix and DOS (though DOS
allows md as an alias on the command line).
Using Path instead of File
Problem
You need more capability than the standard File class. You need to move, copy, delete, and
otherwise work on files with a minimum of coding.
Solution
Consider using the Path class, an intended replacement for File , and the Files class.
Search WWH ::




Custom Search