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
| Word | What it means | Example |
|---|---|---|
| File | One named piece of stored data. | lion.jpg |
| File-based storage | Each set of data is kept in its own file. The program reads and writes the file. | A CSV of students |
| CSV | A text file of rows, with a comma between the values. | Sam,16,12.50 |
| Directory | A folder. It holds files and other folders. | trips |
| Directory-based storage | Files are kept in folders that are named and arranged to show what is inside. | trips/2027/zoo |
| Path | The address of a file. It lists the folders, then the file. | trips/2027/zoo/lion.jpg |
| Root | The top folder that holds all the others. | trips |
| File extension | The letters after the last dot. They show the file type. | .jpg |
| Subfolder | A 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 questionsYour 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-based | Directory-based | |
|---|---|---|
| Idea | Data in its own file | Files arranged in folders |
| Best for | Small amounts of data, settings, exports, logs | Many files, such as photos or documents |
| Finding things | Open the file and look | Follow the path through the folders |
| Good point | Simple, no extra software | Easy to organise, share and set who may open each folder |
| Weak point | Hard to search many files, and data may be repeated | A 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 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.