Files AND Folders
Files hold content; folders organize files and other folders so you can find your work.
Understand the idea
A file is a named item that stores content, such as a picture or the text of a program. A folder, also called a directory, groups files and other folders. A project can be as small as one folder containing one source file. You can inspect it in Finder, File Explorer, or your system’s file manager before learning any terminal commands.
Keep an experiment separate from existing work. You can create a new folder named human-lab inside your own Documents folder using the file manager. This lesson does not create, move, or delete anything on your computer. The tree below is an example of what a small project could contain, not a claim that those files already exist.
A filename may include an extension, such as .py for a Python source file or .txt for plain text. The extension helps tools choose how to handle the file; renaming an extension alone does not translate its contents. Pay attention to the complete name when saving your first program.
Key points
- 01 A file stores content; a folder organizes named items.
- 02 A folder can contain both files and other folders.
- 03 The folder containing a file is its parent directory.
- 04 A project folder keeps an experiment separate from unrelated work.
- 05 An extension is part of a filename, not a conversion of the file’s contents.
Worked example
Read a small project tree
A worked example using sample data. Nothing here runs on your computer.
human-lab/
hello.py
notes/
plan.txthello.py is inside human-lab.
plan.txt is inside notes, which is inside human-lab.The indentation shows containment. The trailing slash marks folders in this illustration. No terminal command is being run.
Visual
flowchart TD P["human-lab folder"] --> S["hello.py file"] P --> N["notes folder"] N --> T["plan.txt file"]
Follow the primary sources
An original HWTL explanation, prepared and independently checked with AI against the sources below. This lesson has not yet been tested with human learners.
Source review completed 2026-10-07.
- MDN: Dealing with files
File-manager navigation, organizing project folders, filenames/extensions, and nested file structures.
- MDN: Code editors
Source code is stored as plain text and should be handled with an editor that preserves plain text.
Practice · predict the result
Find the file and its immediate folder
A small test from your robot instructors. Hints are welcome.
What you will practice: Identify a file and its directly containing folder in a nested project tree.
Sample scenario. Original synthetic tree only. Slashes show containment and folders have explicit folder entries. These files are not read from or created on your computer.
- Project root
/human-lab/- File in the tree
hello.py- Folder in the tree
notes/- File in the tree
notes/plan.txt- Inspect this entry
notes/plan.txt
In this project tree, what kind of entry is notes/plan.txt, and which folder directly contains it?
Attempts stay on this browser and are kept separate from lesson views and your self-reported knowledge.
Sources and exercise scope
- MDN: Dealing with files
Nested project folders, file names and extensions, and relative file references.
Original synthetic exercise, checked with AI against primary documentation on 2026-10-08. Human learner validation is pending. A result here records this attempt; it does not establish mastery.
Make this lesson yours
Save it for later, or tell your robot what would help.
This correction stays on this browser. Browse all concepts if the topic is missing.
Familiarity is your own assessment. To use it in your coding tool, download your updated learning profile.
Choices are saved on this browser. They do not sync to your account or coding tool.
Lesson diagnostics
Download the public lesson material, resource choices, and robot text selected for this page. The file does not include your chat, code, or saved profile. Nothing from the trace is uploaded.
It records the page’s selections, not video playback or proof of learning. A link from your coding tool does not supply its original recommendation trace.
Enable JavaScript to create a trace on this device.