Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

File-based and directory-based storage

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

40 minutes

The messy desktop

Look at this desktop. Report.docx. Report_final.docx. Report_final2.docx. Photo1.jpg. Photo2.jpg. New file.txt.

Nobody can find anything. Now imagine 10,000 files like this.

We need a clear way to store data. Today we look at two ways: files, and folders that hold files.

Key words

WordWhat it meansExample
FileOne named piece of stored data.lion.jpg
File-based storageEach set of data is kept in its own file. The program reads and writes the file.A CSV of students
CSVA text file of rows, with a comma between the values.Sam,16,12.50
DirectoryA folder. It holds files and other folders.trips
Directory-based storageFiles are kept in folders that are named and arranged to show what is inside.trips/2027/zoo
PathThe address of a file. It lists the folders, then the file.trips/2027/zoo/lion.jpg
RootThe top folder that holds all the others.trips
File extensionThe letters after the last dot. They show the file type..jpg
SubfolderA folder inside another folder.2027 inside trips

The cells students fill in are left blank in this preview.

File-based storage

In file-based storage, each set of data lives in its own file. A program opens the file, reads it and saves it.

It is simple. A notes file, a CSV of marks and a settings file are all file-based. But the files know nothing about each other. If the same name is in two files, you must change both.

Quick check: files

Have a go

Quick check: files

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Directory-based storage

In directory-based storage, files go in folders. Folders go inside other folders. The names of the folders tell you what is inside.

You find a file by its path. The path trips/2027/zoo/lion.jpg means: the trips folder, then 2027, then zoo, then the file.

File-based and directory-based

File-basedDirectory-based
IdeaData in its own fileFiles arranged in folders
Best forSmall amounts of data, settings, exports, logsMany files, such as photos or documents
Finding thingsOpen the file and lookFollow the path through the folders
Good pointSimple, no extra softwareEasy to organise, share and set who may open each folder
Weak pointHard to search many files, and data may be repeatedA wrong folder name hides a file

The cells students fill in are left blank in this preview.

Which storage would you choose?

Have a go

Which storage would you choose?

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The lesson goes on

8 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.