The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.io  [35 examples] > Directories  [6 examples]

e32. Listing the File System Roots

UNIX file systems have a single root, `/'. On Windows, each drive is a root. For example the C drive is represented by the root C:\.
    File[] roots = File.listRoots();
    for (int i=0; i<roots.length; i++) {
        process(roots[i]);
    }

 Related Examples
e28. Getting the Current Working Directory
e29. Creating a Directory
e30. Deleting a Directory
e31. Listing the Files or Subdirectories in a Directory
e33. Traversing the Files and Directories Under a Directory

See also: Encodings    Filenames and Pathnames    Files    Parsing    Reading and Writing    Serialization   


© 2002 Addison-Wesley.