C. Computer Environments and Systems Β· Computer Environments and SystemsOrganizing Programs and Files on Local and Shared Drives
C2.1About 65 minutes
Learning goals- I can explain how an operating system organizes files in a hierarchy of folders, and read absolute and relative paths.
- I can create, name, move, copy, rename, delete and find files and folders using the operating system.
- I can choose good file and folder names and set up a logical folder structure for my programs.
- I can explain the difference between local drives, shared network drives and cloud storage, including permissions.
Words to know
file system
The part of the operating system that organizes data on a drive into files and folders.
folder (directory)
A container that holds files and other folders.
root
The top folder of a drive: C:\ on Windows or / on macOS and Linux.
path
The list of folders that leads to a file. An absolute path starts at the root; a relative path starts at the current folder.
file extension
The letters after the last dot in a file name (.py, .txt, .jpg) that tell the operating system the file type.
local drive
A drive inside or attached to your own computer.
shared (network) drive
A drive on a server that several users reach over a network, often given a letter such as H: or S:.
permissions
Rules that say who can read, change (write) or run a file or folder.
Where did I save that?
It is 11:30 p.m. and your programming assignment is due at midnight. You know you saved assignment2.py, but it is not on the desktop, not in Downloads, and there are three files called assignment2 (1).py, assignment2 final.py and assignment2 final REAL.py. Which one is the latest?
Good programmers avoid this by organizing their files. The operating system gives you the tools; this lesson shows you how to use them well, on your own computer and on a school network.
How a file system is organized
The operating system's file system arranges files in a hierarchy (a tree):
- At the top is the root of each drive:
C:\ on Windows, / on macOS and Linux. - Folders (also called directories) hold files and other folders.
- A path lists the folders that lead to a file. Windows separates them with
\; macOS and Linux use /.
An absolute path starts at the root and works from anywhere, such as C:\Users\sam\Documents\ICS3U\notes.txt. A relative path starts from the current folder (the working directory). If you are already in ICS3U, the relative path is just notes.txt, and .. means "go up one folder".
File extensions tell the operating system what kind of file it is and which program opens it: .py (Python source code), .txt (plain text), .docx (word-processor document), .jpg/.png (images), .zip (compressed archive), .exe (a Windows program). Windows hides extensions by default; turning on File name extensions in File Explorer's View menu helps you spot fakes like homework.pdf.exe.
A logical folder tree for a computer science course. Folders are numbered so they sort in course order, and file names describe their contents.Programs versus your files
The operating system keeps installed programs in special folders (C:\Program Files on Windows, /Applications on macOS) and its own system files in protected folders. Leave these alone: install and remove programs with the operating system's tools (Settings β Apps on Windows; drag to the Trash or use the app's uninstaller on macOS), never by deleting their folders.
Your own work belongs in your user folder (Documents, or a course folder) or on a network or cloud drive your school provides, not scattered across the desktop and Downloads.
Good names and a logical structure
- Descriptive names:
a2_temperature_converter.py, not untitled3.py. - No spaces or special characters in code files. Use underscores or hyphens. Python can't
import a file whose name has spaces or hyphens, and command-line tools treat spaces as separators. - Dates as YYYY-MM-DD (2026-09-14). They sort in the right order automatically, and nobody confuses 09/10 for September 10 or October 9.
- Number folders (01-, 02-) to keep them in course order.
- Versions on purpose:
report_v1, report_v2, not final, final2, final REAL. (Programmers use a version-control tool such as Git for this, which you may meet in Grade 12.) - One project per folder: keep a program and the data files it reads together, so relative paths work.
Operations. Use your operating system's file manager (File Explorer on Windows, Finder on macOS, Files on ChromeOS) to create, rename, copy, move, delete and search. Remember that moving changes a file's path (programs that use the old path will break), and that deleted files go to the Recycle Bin or Trash first, but deletions on network drives and USB flash drives often skip it.
Local, shared and cloud drives
- Local drive: inside your computer (
C:). Fast and available offline, but only on that device, and lost if the drive fails. - Shared network drive: on a school or company server, reached over the network and often mapped to a letter, such as
H: for your personal home folder and S: for a shared class folder. You can log in from any school computer and see your files. Servers are usually backed up by the IT department. - Cloud storage (OneDrive, Google Drive, iCloud and others): files stored on a company's servers and synced over the internet to your devices.
Shared drives use permissions. A teacher might give students read-only access to a handouts folder, read and write access to a submission folder, and no access to other students' folders. Respect them: never save over or delete someone else's work in a shared folder, and never share your login.
Your files can live on a local drive, a shared network drive or in cloud storage. Each has different speed, access and safety trade-offs.from pathlib import PureWindowsPath
p = PureWindowsPath(r"C:\Users\sam\Documents\ICS3U\a1_tip_calculator.py")
print("Name:", p.name)
print("Extension:", p.suffix)
print("Folder:", p.parent)
print("Drive:", p.drive)
Python's pathlib module splits a path into its parts. PureWindowsPath works the same on any operating system, so the output is the same everywhere. Output (one line each): Name: a1_tip_calculator.py / Extension: .py / Folder: C:\Users\sam\Documents\ICS3U / Drive: C:
Organizing files with Python
Programs can organize files too. The program below builds a course folder structure inside the current folder, saves a starter file, and lists everything it made. mkdir(parents=True, exist_ok=True) creates any missing folders and does not complain if they already exist. rglob("*") finds everything inside a folder, at every level.
from pathlib import Path
base = Path("ICS3U")
for unit in ["01-programming-basics", "02-arrays-and-subprograms"]:
(base / unit / "assignments").mkdir(parents=True, exist_ok=True)
starter = base / "01-programming-basics" / "assignments" / "a1_tip_calculator.py"
starter.write_text("# Tip calculator\n")
for item in sorted(base.rglob("*")):
kind = "file " if item.is_file() else "folder"
print(kind, item.as_posix())
Run this in an empty practice folder. The / operator joins path parts, and as_posix() prints paths with forward slashes on every operating system. Output (one line each): folder ICS3U/01-programming-basics / folder ICS3U/01-programming-basics/assignments / file ICS3U/01-programming-basics/assignments/a1_tip_calculator.py / folder ICS3U/02-arrays-and-subprograms / folder ICS3U/02-arrays-and-subprograms/assignments
Worked exampleExample 1: Reading paths
Sam's current folder is C:\Users\sam\Documents\ICS3U\02-arrays-and-subprograms. Write (a) the absolute path and (b) the relative path to C:\Users\sam\Documents\ICS3U\notes\2026-09-14_variables.txt.
- (a) The absolute path is simply the full path from the root:
C:\Users\sam\Documents\ICS3U\notes\2026-09-14_variables.txt. - (b) For the relative path, find the shared folder. Both paths go through
ICS3U. From 02-arrays-and-subprograms, go up one level to ICS3U with ... - Then go down into
notes and name the file: ..\notes\2026-09-14_variables.txt.
(a) C:\Users\sam\Documents\ICS3U\notes\2026-09-14_variables.txt (b) ..\notes\2026-09-14_variables.txt
Worked exampleExample 2: Clean up a messy folder
A Downloads folder contains: IMG_2041.jpg, assignment2 final.py, assignment2.py, Tip Calc.py, ics notes sept.txt, setup_installer.exe. Propose a better organization.
- Decide on a structure:
ICS3U\01-programming-basics\assignments for code, ICS3U\notes for notes, and a Pictures folder for photos. - Compare the two assignment 2 files (open both, check the date modified column) and keep the newest as
a2_temperature_converter.py; move the older one into an old folder rather than deleting it until you are sure. - Rename
Tip Calc.py to a1_tip_calculator.py (no spaces) and ics notes sept.txt to 2026-09-14_variables.txt (date first, then topic). - Move
IMG_2041.jpg to Pictures. The installer has done its job; once the program is installed, the .exe can be deleted.
A course folder with numbered unit folders, descriptive names without spaces, ISO dates, and nothing important left in Downloads.
Just for funThe "Save" button in many programs is still a picture of a floppy disk, a storage device most Grade 11 students have never touched. A 3.5-inch floppy held 1.44 MB: less than one photo from a modern phone.
Hands-on activityBuild your course filing system
You need: a computer with Python and the operating system's file manager.
- Make a practice folder called
file_practice in Documents. Open it in the file manager and turn on file name extensions (Windows: View β Show β File name extensions; macOS Finder: Settings β Advanced β Show all filename extensions). - Save the second program above as
make_folders.py inside file_practice and run it from there. Watch the folders appear in the file manager. - Using only the file manager, create a
notes folder, rename a file, move a file into another folder, and copy a file. Then use the search box to find a1_tip_calculator.py. - Write the absolute path and a relative path (from
02-arrays-and-subprograms) to the starter file. - If your school gives you a network or cloud drive, find it and note its letter or name, and which folders you can only read.
- Set up the real folder structure you will use for the rest of this course.
What to look for: a tidy structure with numbered folders and descriptive names; correct paths (the relative path is ..\01-programming-basics\assignments\a1_tip_calculator.py on Windows, with / instead of \ on macOS).
Your turn
1What is the root folder of the main drive on Windows? On macOS?
2Is ..\notes\plan.txt an absolute or a relative path? What does .. mean?
Relative. .. means go up one folder from the current folder.
3Give two reasons not to use spaces in Python file names.
Python cannot import a module whose name has spaces, and command-line tools treat spaces as separators between items.
4Rename My Program FINAL(2).py to follow this lesson's guidelines, assuming it is assignment 3, a quiz game.
5What does the extension .exe tell you, and why should you be careful with photo.jpg.exe?
.exe means a Windows program. photo.jpg.exe is a program pretending to be a picture, a common malware trick.
6What is the difference between a local drive and a shared network drive?
A local drive is in your own computer and only available there. A shared network drive is on a server and can be reached from many computers by authorized users, with permissions.
7Why are dates written YYYY-MM-DD in file names?
They sort in date order automatically and cannot be confused (09/10 could be September 10 or October 9).
More practice: warm-up
1What is another name for a folder?
2What is the extension of a Python source file?
3Which character separates folders in a Windows path? In a macOS path?
4Which program do you use to manage files on Windows? On macOS?
File Explorer on Windows; Finder on macOS.
5Where does a deleted file on your local drive usually go first?
To the Recycle Bin (Windows) or Trash (macOS).
More practice: on your own
1Your current folder is /Users/ana/ICS3U/notes. Write the relative path to /Users/ana/ICS3U/02-arrays/a5_lists.py.
../02-arrays/a5_lists.py (up to ICS3U, then down into 02-arrays).
2A program opens scores.txt with a relative path and crashes with FileNotFoundError, although the file exists. Give a likely reason.
The program is running from a different current (working) folder than the one holding scores.txt, so the relative path points to the wrong place. Keep data files in the program's folder and run it from there, or use the correct path.
3A teacher wants students to read handouts but not change them, and to submit work without seeing each other's. Describe the permissions.
Handouts folder: read-only for students. Submission folder: students can write (add files) but not read or change others' files; only the teacher can read everything.
4Using PureWindowsPath, what would print(PureWindowsPath(r"D:\Games\save1.dat").suffix) print?
5Give one advantage and one disadvantage of cloud storage compared with a local drive.
Advantage: reach your files from any device and they survive if your computer breaks. Disadvantage: needs an internet connection to sync, and your files are stored on another company's servers (privacy).
Challenge
1Write a Python program that uses pathlib to create the folders photos/2026 and photos/2027 inside the current folder and then prints the names of the folders inside photos, in sorted order, one per line.
Sample: from pathlib import Path, then for year in ["2026", "2027"]: / (Path("photos") / year).mkdir(parents=True, exist_ok=True), then for p in sorted(Path("photos").iterdir()): / print(p.name). It prints 2026 and 2027 on separate lines.
2A student moves her whole project folder from Documents to her school H: drive. Programs that used relative paths still work; one that used an absolute path breaks. Explain why.
A relative path is measured from the program's folder, which moved along with the files, so it still points to the right place. An absolute path names the exact old location (C:\Users\...\Documents\...), which no longer has the files.
3Design a folder structure for a three-person team project (a game) on a shared drive. Include where code, images, sounds and documentation go, and one rule about names.
Sample: S:\ICS3U\team-arcade\ with src\ (Python files), assets\images\, assets\sounds\, docs\ (design, status reports) and old\ for retired versions. Rule: lowercase names with underscores and no spaces, and dated docs as YYYY-MM-DD_topic. Each member edits only the files they are assigned, to avoid overwriting each other's work.
Check your understandingQuiz
1. Which is an absolute path?
2. What does .. mean in a path?
3. Which file name follows good practice for a Python program?
4. Why should dates in file names be written 2026-09-14?
5. Students can open but not change the files in a handouts folder on the school server. This is controlled by...
6. Where should installed programs be removed from?
For parents and teachersBig idea: Expectation C2.1 asks students to use an operating system to organize programs and files logically on local and shared drives. Organization is a habit that saves hours in this course.
How to help: Ask your teen to show you their course folder. Can they find last week's program in under 30 seconds? If the family shares a computer, agree together on where each person's files go. If the school provides a network or cloud drive, help your teen sign in from home if that is allowed.
Common difficulties:
- Saving everything to Downloads or the desktop.
- Confusing absolute and relative paths, especially
... - Programs that cannot find a data file because they run from a different working folder.
- Deleting from a network or USB drive and expecting it to be in the Recycle Bin.
- Hidden file extensions; turning them on helps spot disguised programs.