Where Are My Files?

When you are using Microsoft Word to write an essay on your home computer, and you click "Save", it is usually OK to let Word store the file in some default location such as a "My Documents" folder. But in a programming course, that won't work. An assignment may have multiple files that you'll need to find and package up into a complete submission. You are going to need to know exactly where those files are stored.

Devices and Filesystems

Files are stored on devices such as hard disk drives, flash drives, CDs and DVDs. These may be physically connected to the computer you're using, or they may be accessed through a network.

Each device starts with a root directory within which all other files and subdirectories on the drive reside. (Directories are also called "folders.") When we view this root directory using the operating system, the filesystem appears as an organized hierarchy, or tree-like structure.

On Windows operating systems, each device is identified by a single letter of the alphabet. For instance, the root of the main internal hard drive of the machine is typically the C: drive (A: and B: were historically reserved for floppy disks.) As you insert flash drives or CDs, they are normally assigned the next available drive letter, perhaps D: or E:. Devices on a network can also be mapped to a drive letter.

In OS X, the root of the main filesystem is denoted by a single forward-slash character ("/").

Each file on a device is identified by its path, which is the chain of directories (folders) you'd look in to find it. For instance, the path to the file Greeter.java that you will create in this lab might be

U:\cs227\workspace\project1\src\lab1\Greeter.java

Image of file tree

(The root directory on Linux and OS X is simply a forward slash/, and just like web addresses, paths are specified with forward-slashes instead of backward-slashes, e.g., on a Mac the path to Greeter.java could look like: /Users/username/Documents/workspace/project1/src/lab1/Greeter.java).