File Not Found

What is a file? What is a folder? And should you care?

2021-10-22 Previous Home Next

Many people, it seems, don't quite understand why files and directories ("folders") are important to know about. They never need to open something called a "file." They just rely on their apps to remember which documents to open.

(See article in The Verge about how professors are frustrated.)

pointing html

After all, when using the Internet and your phone, you can always use a search function to find anything you need.

Do you need to know what a file is?

Even if you don't know what a file is, you do use one when accessing the same data from multiple apps.

For example, say you want to send someone a photo by email.

You can do it in two ways: either share the photo from your photo app, or open the email app and ask it to attach a picture.

The second way is an example of using files.

Your email app shows you small thumbnails from a picture gallery organized by your photo app, and when you select a picture, it attaches that picture to your email.

How does your email app find the pictures from your camera?

The pictures are contained in files, and the email app has some information about where your camera app stores its photos.

The more you need to manipulate data from multiple programs, the more likely it is that you'll need to understand files and folders.

So, what is a file?

A file is a container for data: a document, a picture, a video, etc.

Any kind of computer you use today offers a sort of database called a file system that stores all its files. All programs running on the computer can find these files and read and write the data in them.

The data in the file is stored as a string of numbers. If you were to look inside a file containing the search image above, you would see about three thousand six hundred numbers starting with:

137 80 78 71 13 10 26 10

The numbers are interpreted by whichever app is using the content.

The first eight numbers in this file identify it as a PNG format image. The three numbers 80 78 71 stand for the letters "PNG". (You can read the Unicode article to see how).

Your browser knows how to draw images in this format. That's how the image showed up above.

Finding files

To find a file in the file system, you need its reference, like an address.

The references are arranged in hierarchical groups, like street addresses organized by state, city, and street. These grouping locations are called directories or folders.

For any group, the file system lets you look at all the references under it one by one, in the same way that if you've forgotten the house number, you can look through the whole street to find it.

So that's what a file is: a container containing data, identified by a reference in the computer's file system.

In our email example above, the camera app always stores its photos under a particular grouping location (say, on a particular street). The email app knows this grouping location, so it can find all the files containing camera images.

This is how it can show you the entire gallery of photos.

When you select one image, it opens the file and attaches a copy of the numbers inside it to the email.

When the recipient's email app receives the numbers, it can see that they describe a PNG format image, which it draws on their screen.