The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.io  [35 examples] > Filenames and Pathnames  [6 examples]

e18. Determining If a Filename Path Is a File or a Directory

    File dir = new File("directoryName");
    
    boolean isDir = dir.isDirectory();
    if (isDir) {
        // dir is a directory
    } else {
        // dir is a file
    }

 Related Examples
e13. Constructing a Filename Path
e14. Converting Between a Filename Path and a URL
e15. Getting an Absolute Filename Path from a Relative Filename Path
e16. Determining If Two Filename Paths Refer to the Same File
e17. Getting the Parents of a Filename Path

See also: Directories    Encodings    Files    Parsing    Reading and Writing    Serialization   


© 2002 Addison-Wesley.