Directory tree – paths and file search
Computer ScienceFiles, Storage & DatabasesAges 11–12
Use it with your class: students open it from a link or a QR code, with no account needed.
A directory tree you can click to expand, collapse, and select, just like File Explorer. Students pick a file to read its absolute path (from the drive) and relative path (from the current directory, using “..” to go up a level), create a new file, move a file to another folder, and type a name to search for files across the whole tree. The goal is to make the hierarchical structure of a file system clearly visible.
Lesson: Files and directories: paths, creating, copying, moving and searching for files
What it shows
A file system organizes storage as a tree: a drive at the root, directories (folders) that can hold further directories, and files as the leaves. Every item therefore has exactly one absolute path, listed from the drive down through each directory. A relative path is written from the current directory instead, and “..” means moving up to the parent directory. This simulation builds such a tree, shows both paths for any selected item, reports properties such as size, contents and level in the tree, and lets students create, move and search for files.
How to use
Set Number of directory levels and Number of files per directory to suit the class, then expand the tree and click a file. With the Path panel open, compare its absolute and relative paths. Select another folder, press Set as current directory and watch the relative path change while the absolute path stays the same. Try Move to current directory to see how a file's path changes, and use Find to search the tree by part of a name.
Parameters you can change
- Number of directory levels 2–4 levels
- Number of files per directory 1–4 files
- Right panel shows Absolute and relative path, Directory / file properties, Find file by name
- Show file size
Questions to explore
- How does the relative path of the same file change when you choose a different current directory?
- How many “..” steps does the relative path need to reach a file in a neighboring folder, and why?
- When a file is moved to another directory, what changes in its path and what stays the same?