Quick Links

Files and folders are a common metaphor for storing data on a computer. Even a modern device that hides files from you as much as possible still uses them under the hood. Here's a look at what files and folders are---and how computers got that way to begin with.

What Is a File?

When it comes to computers, a file is an abstract idea. It's a conceptual object -- more precisely, a group of related computer records treated as a single unit. The method by which computer operating systems store and retrieve files from disk is called a file system.

Related: What Is a File System, and Why Are There So Many of Them?

Files keep related data together so it isn't lost or disorganized, and so you can find it when you need to read or process it. Usually, each file represents a single document (such as a book report), a spreadsheet, a digital image, a video, a song, or otherwise. A file can also be a program that tells a computer what to do.

Applications use many files to work, including executable program files (that contain the instructions required to run the program), configuration files (that tell the program how to run), and data files that might store extra required information in a modular way.

Today, thanks to graphical operating system icons, many people think of a file as being equivalent to a document such as as a piece of paper, or perhaps a photographic print. Interestingly, the term "computer file" originated in the 1950s from a different (but related) metaphor.

The Origins of the File Metaphor

In a paper-based office, a "file" is a set of documents stored together in a container or a drawer, such as in a file cabinet. A file can also be the name of the cabinet itself. At the dawn of computing, many computers used punched cards to store data. Each card didn't hold much information, so a program or set of records typically spanned a stack of punched cards. When not in use, these stacks of cards were often stored in a file (a collection of related cards grouped together) within a special file cabinet or in large tubs called "tub files."

When it came time to load the data into the computer, someone would retrieve a "file of punched cards" and load it into a machine for reading. So at this time, a computer file was just a physical collection of records stored on paper. Later, when magnetic tape came into computer use, "files" were still typically associated with the physical media itself (such as a "tape file"), since the data was stored in a linear fashion and associated with other records by its location on a physical tape spool.

According to the Encyclopedia of Computer Science by Anthony Ralston (1976), when random access magnetic disks came on the scene, the concept of a "computer file" began to break free from its physical constraints. When hard drives became large enough, a computer file (a collection of related records, remember) could suddenly live anywhere on disk, even broken into pieces--that is, not necessarily stored in a physically contiguous manner on the disk's surface. At that point, a computer file became a logical concept: a collection of data defined by a digital index rather than a collection of data physically grouped together. That definition persists today.

What Is a Folder?

A folder is a collection of files. In modern operating systems, each folder can typically contain files, other folders, or both. Folders are a great way to organize files into groups that make sense for later retrieval.

A potentially confusing aspect of folders is that they are also sometimes called "directories." That's because a "directory" was an earlier term of a list of files on a disk. When PC operating systems began to support subdirectories (directories within directories) on larger disks in the 1980s, people used directories to group related files together in the same way we use folders today.

The modern concept of a "folder" on a computer originated in the 1981 with the Xerox Star operating system, which represented directories with icons that looked like manila file folders used with paper in an office environment. Later, the Apple Macintosh popularized this concept of the folder-as-directory, and Windows adopted it as well.

Related: Macintosh System 1: What Was Apple's Mac OS 1.0 Like?

Folders vs. Directories---and Directory Hierarchy

In most operating systems, folders and directories are basically the same thing, although sometimes folders can be special containers for things other than files, such as groups of settings or options in certain versions of Windows.

What's important to know is that directories are typically hierarchical. That is, each directory can contain other directories, themselves containing files or directories. If you visually map out the resulting nest of directories, it will look like the branches of a tree coming off a main trunk, with the trunk representing the main (or root) directory.

Hierarchical file systems originated with Multics in the 1960s, and early PC operating systems often didn't support directory hierarchy (MS-DOS 1.0 or the original Mac OS, for example) until hard disks (that could store many floppies worth of data) became more common in the mid-1980s.

Related: 40 Years Later: What Was it Like to Use an IBM PC in 1981?

What is a File Path?

A reference to the location of a file within the directory hierarchy is called a path. A path is kind of like an address that tells you (or a program) how to locate a file. On Windows, a file path, when written out, will typically look something like this:

        C:\Users\Benj\Desktop\Photos\Photo.jpg
    

When viewed graphically in File Explorer as icons, you'll see this path as nested folders contained within each other. Or you might see a breadcrumb that reads "[Username] > Desktop > Photos" while viewing the current location of "Photo.jpg." But on the command line, Windows uses the backslash character ("\") to separate directories in a path instead of windows and icons.

Related: How to Copy the Full Path of a File on Windows 10

While reading the Windows path, the hierarchy goes from left to right, with the containing folders written to the left of those within. So first, you see "C:\," which is the name of the disk drive ("C:") paired with the root directory ("\"), then "Users," which is a directory off of "C:\," then the "Benj" directory, which is within the "Users" folder, and so on. Ultimately, you get to "Photo.jpg," which is the file in question, and you know exactly where it's located on the drive.

On a Mac, a path on the command line might look something like this:

        /Users/Benj/Documents/Photos/Photo.jpg
    

As with Windows, you read the path from left to right, increasing in hierarchical depth as you move to the right. Instead of the backslash in Windows ("\"), macOS and other Unix-like operating systems use a slash ("/") to separate the directories in a path.

While browsing folders in the macOS Finder, you'll see the current path as a breadcrumb at the bottom of the window, such as "Macintosh HD > Users > [Username] > Documents > Photos" if you have "Show Path Bar" enabled (Press Option+Command+P or select View > Show Path Bar in the menu bar). In that case, each angle bracket (">") represents another level in the folder hierarchy similar to a slash ("/").

What Are File Formats?

A file format describes how data is stored within a file. Different programs handle data differently, and for the program to understand the data in a file, that data needs to be formatted a certain way. Different file formats and the metadata associated with them allow operating systems (and applications) to distinguish between different types of files.

Related: What Is A File Extension?

File formats are often labeled with file extensions, which are typically three- or four-letter abbreviations located at the end of a file name behind a period.

Examples of file formats and their extensions include ".JPG" for JPEG image files, ".MP3" for MP3 audio files, or .HTML for HTML web page files. There are thousands of different file formats, and understanding them is one of the biggest challenges in computers today---especially when it comes to reading formats created by obsolete software.

Finding a File's Location

So you're looking for a file. How do you find it--and how do you find its location (path)? It depends on which operating system you're using.

  • Windows 10: Press Windows+s on your keyboard and type in the name of the file you'd like to find. In the results, right-click the file and select "Open File Location." File Explorer will open the file's location in a window, and you can find its path in the breadcrumb address bar at the top of the window. Or you can right-click the file in File Explorer and select "Copy as Path," then paste the path wherever you need it.
  • Windows 11: As with Windows 10, press Windows+s on your keyboard and type in the name of the file you want to find. In the results, you'll see the path listed in the info window under "Location." You can also right-click the file in the results and select "Copy as Path" to get the full system path of the file, which you can then paste into any app or document.
  • macOS: To do a quick search, use Spotlight: Press Command+Space or click the small magnifying glass icon in the menu bar at the top of the screen. Type in the file name you're looking for, then click "Show All in Finder" at the bottom of the results list. Once in Finder, right-click the file and select "Show in Enclosing Folder." When the file location opens in a window, show the path bar by pressing Option+Command+P  (or selecting View > Show Path Bar in the menu bar), and you'll see the path in bread crumbs at the bottom of the window. If you right-click the file in the breadcrumb path, you can select "Copy as Pathname," then paste the path into whatever you'd like.
  • iPhone/iPad: On these platforms, you'll never see the raw system path of any file because it is hidden from the user. But you can search for apps and documents swiping down with one finger on the home screen and typing a name. Also, if you downloaded a file, you can usually locate it in the "Downloads" directory within the Files app. Within the Files app, you can tap the search bar, type a file name, then long-press it and select "Get Info." If you scroll down, you'll see its path within Files in the "Where" section.
  • Android: Like iOS, you don't typically see the raw system path of files in Android while using apps, but it's possible while using a File Manager (such as Files by Google). In Files By Google, for example, tap the magnifying glass icon and type in file name to search for. In the results list, tap the three dots button the file and select "File Info." In the pop-up that opens, you'll see the full system path listed.
  • ChomeOS: Similar to Android, ChromeOS on Chomebooks generally tries to hide the file system from users, although you can manage files in the Files app. To find a file's path, launch the Files app, then click the magnifying glass icon in the toolbar. Type in a file name, and in the results list, right-click a file and select "Get Info." You'll see the file's path in the info box that pops up under "File Location."

The Verge recently reported that due to the rise of operating systems that mostly hide the file system from users (such as iOS on iPhone), some college students are having difficulty with the concept of storing or locating files in a particular file path or location. But now you know that even if an operating system obscures concepts of file path or directory hierarchy from you, there's always a path somewhere if you peek behind the curtain. Good luck!

Related: 3 Ways to See the Current Folder Path on Mac