The Windows File System, Demystified
Drives, paths, slashes, hidden files, and where your work actually lives — the foundation for everything that follows.
Module 1 · OverviewBy the end of this module you can…
- Explain the difference between a disk, a file system, and what Explorer shows you
- Read and write absolute and relative paths with confidence
- Know when to use
/versus\— and why Python prefers/ - Reveal file extensions and hidden items in Explorer
- Find your way around your user profile and
AppData - Set up a safe workspace at
C:\actuarial_work\, outside OneDrive
A Mental Model
What a disk actually is — and why Explorer is only one (opinionated) view of it.
Mental modelThree layers, not one
Programming tools talk to the file system directly, not to Explorer. When Explorer “hides” something, your code still sees it — and when Explorer shows a shortcut like Quick access, your code does not.
Mental modelWhat Explorer shows vs. where things really are
| Explorer says… | The real path is often… | Why it matters |
|---|---|---|
| Desktop | C:\Users\Jane\OneDrive\Desktop | May be silently synced to the cloud |
| Documents | C:\Users\Jane\OneDrive\Documents | Same — “Known Folder Move” |
| Downloads | C:\Users\Jane\Downloads | Usually not synced |
| Quick access / Home | nowhere — it’s a list of shortcuts | Can’t cd into it |
| This PC | nowhere — a virtual summary of drives | Not a real folder |
Click the Explorer address bar (or press Alt+D): the breadcrumb turns into the real path. Get into this habit now.
Mental modelIt’s all one tree
Every drive is an upside-down tree:
- The root is the drive itself:
C:\ - Folders (a.k.a. directories) are branches
- Files are leaves
- A path is the route from the root to a leaf
Programmers say “directory”; Windows says “folder”. Same thing.
C:\
├── Program Files\ apps (admin only)
├── Windows\ the OS — hands off
├── Users\
│ └── Jane\ your "home"
│ ├── AppData\ hidden!
│ ├── Desktop\
│ ├── Documents\
│ └── Downloads\
└── actuarial_work\ ← we'll make this
└── pricing\
├── model.py
└── data\
└── input.csv
DrivesDrive letters and volumes
| Letter | Typically |
|---|---|
C: | The system drive — Windows, apps, users |
D:, E:… | Second disks, USB sticks, SD cards |
H:, S:… | Mapped network drives at work/school |
A: and B: were reserved for floppy disks — which is why the system drive is C:.
Network paths (UNC)
A mapped drive is a nickname for a UNC path:
H:\ → \\fileserver01\home\jane
S:\ → \\corp.local\shared\Actuarial
Network drives are slow for thousands of small files and may vanish off-VPN. Keep code and environments on your local disk.
DrivesOneDrive: helpful for Word, hazardous for code
Sync storms
A Python environment holds tens of thousands of small files. OneDrive tries to upload every one.
Locked & duplicated files
Sync locks files mid-write, then “resolves” conflicts with copies like model-LAPTOP-7F.py.
Files-on-demand
Cloud-only placeholders (☁) look present in Explorer but aren’t on disk when your code needs them.
Rule for this course: code lives in C:\actuarial_work\, which OneDrive doesn’t touch. Backups and history come from Git + GitHub (Module 5), which is designed for code.
File Paths
Absolute vs. relative, and the tale of two slashes.
PathsAnatomy of an absolute path
C:\Users\Jane\projects\model.py
Drive
C: — which volumeFolders
Users\Jane\projects — the route down the treeName
model — the file’s stemExtension
.py — what kind of fileAn absolute path starts at the root. It means the same thing no matter where you are.
Downside: it only works on your machine. Your colleague isn’t called Jane.
PathsRelative paths: directions from where you stand
A relative path starts from the current working directory (CWD).
. | this folder |
.. | the parent folder |
data\input.csv | down into data |
..\data\input.csv | up one, then down |
C:\actuarial_work\pricing\
├── data\
│ └── input.csv
├── notebooks\ ← you are here
│ └── explore.ipynb
└── src\
└── model.py
From notebooks\, the data file is ..\data\input.csv.
From the project root it’s just data\input.csv.
Relative paths make projects portable: zip the folder, send it to a colleague, and every path still works.
Check yourselfResolve these paths
Your CWD is C:\actuarial_work\pricing\src. Where does each point?
| Relative path | Resolves to |
|---|---|
model.py | C:\actuarial_work\pricing\src\model.py |
..\data\input.csv | C:\actuarial_work\pricing\data\input.csv |
..\.. | C:\actuarial_work |
.\..\src\.\model.py | C:\actuarial_work\pricing\src\model.py (silly but legal) |
SlashesForward /, back \, and escaping
- Windows traditionally separates folders with
\ - Most Windows APIs also accept
/ - But in most programming languages,
\inside a string is an escape character:\n= newline,\t= tab
That innocent-looking path contains a newline and a tab. Python will look for a file that doesn’t exist — or error out.
# ❌ Broken: \n and \t are escape sequences
path = "C:\new_data\tables.csv"
# ✅ Option 1: forward slashes (preferred)
path = "C:/new_data/tables.csv"
# ✅ Option 2: a raw string — backslashes taken literally
path = r"C:\new_data\tables.csv"
# ✅ Option 3: escape each backslash
path = "C:\\new_data\\tables.csv"
InterludeMeanwhile, in UNIX-land (Linux, BSD, macOS)
- One tree, rooted at
/— no drive letters - Other disks are mounted as folders:
/mnt/usb,/Volumes/USB - Home is
/home/jane(Linux) or/Users/jane(macOS), shortened to~ - File names are usually case-sensitive:
Data.csv ≠ data.csv - Network shares are
//server/shareorsmb://server/share
/
├── bin/
├── etc/
├── home/
│ └── jane/ ~
│ └── actuarial_work/
└── mnt/
└── usb/ a "drive"
In UNIX, \ is never a path separator — in file paths or network paths. It is only an escape character.
InterludeWhy Python wants you to use / — even on Windows
- Python on Windows happily accepts
/ - No escaping headaches
- The same code runs unchanged on Linux & macOS
- Better still:
pathlibbuilds paths for you and prints them the native way
from pathlib import Path
project = Path("C:/actuarial_work/pricing")
data_file = project / "data" / "input.csv" # "/" joins parts
print(data_file) # C:\actuarial_work\pricing\data\input.csv
print(data_file.suffix) # .csv
print(data_file.exists()) # True / False
home = Path.home() # C:\Users\Jane (or /home/jane)
House rule: write / in your code; let Windows show you \ in Explorer.
What Explorer Hides From You
File extensions, hidden items, and your user profile.
ExtensionsThe case of model.py.txt
By default, Explorer hides known file extensions. So:
- You save
model.pyfrom Notepad - Notepad quietly adds
.txt - Explorer shows model.py — looks perfect
- Python says file not found 🤯
| Explorer shows | Actual name |
|---|---|
| model.py | model.py.txt |
| claims | claims.csv |
| invoice.pdf | invoice.pdf.exe ⚠️ |
The last row is a classic malware trick. Showing extensions is a security habit, too.
ExtensionsTurn on extensions & hidden items
Windows 11
- Open Explorer (Win+E)
- View → Show
- Tick File name extensions
- Tick Hidden items
Windows 10
- Open Explorer (Win+E)
- Click the View ribbon tab
- Tick File name extensions
- Tick Hidden items
Once hidden items are visible, you’ll start seeing programmer furniture:
.git\ .venv\ .gitignore .python-version AppData\
Names starting with a dot are a UNIX convention for “hidden”; you’ll create plenty of them in this course.
User profileYour home: C:\Users\<username>
C:\Users\Jane\ %USERPROFILE%, $HOME, ~
├── .local\bin\ uv installs here (Mod 4)
├── AppData\ hidden
│ ├── Local\ caches, per-machine
│ ├── LocalLow\ sandboxed apps
│ └── Roaming\ settings that follow you
├── Desktop\
├── Documents\
├── Downloads\
├── OneDrive\
└── .gitconfig Git settings (Mod 5)
- Everything in here is yours — no admin rights needed
- Three names for the same folder:
%USERPROFILE%— Explorer / cmd$HOMEor~— PowerShellPath.home()— Python
Type %USERPROFILE% or %LOCALAPPDATA% into Explorer’s address bar and press Enter.
User profileAppData: where programs keep their stuff
| Folder | Holds | Example |
|---|---|---|
AppData\Roaming%APPDATA% | Small settings meant to follow you between machines on a corporate network | Code\User\settings.json (VS Code) |
AppData\Local%LOCALAPPDATA% | Large, machine-specific data: caches, per-user installs | uv\cache\, Programs\Microsoft VS Code\ |
AppData\LocalLow | Low-trust / sandboxed apps (browsers, some games) | — |
Browse it to understand it — but don’t delete things in AppData unless you know which program owns them.
PermissionsFile permission basics
Yours
C:\Users\Jane\… and folders you create, like C:\actuarial_work.
Read, write, delete freely.
Admin only
C:\Program Files, C:\Windows, other users’ profiles.
Triggers a UAC prompt.
Locked
A file open in another program — e.g. a workbook in Excel (look for ~$claims.xlsx).
“Permission denied” even though it’s yours.
Every tool in this course installs per-user, inside your profile. You should almost never need “Run as administrator”.
Hands-on Lab · 40 minSet up your workspace
- Unmask file extensions and hidden items
- Trap yourself with
model.py.txt— then escape - Create
C:\actuarial_work\outside OneDrive - Navigate the tree using only the keyboard
Deliverable
A folder structure like this, verified via the address bar:
C:\actuarial_work\
└── sandbox\
├── data\
├── notebooks\
└── notes.txt
Lab · Steps 1–2Unmask the extensions
- Open Explorer → View → Show → tick File name extensions and Hidden items.
- Visit
%USERPROFILE%. FindAppData(now visible, slightly faded). - Open Notepad, type
print("hello"), and Save Asmodel.pyon the Desktop with “Save as type: Text Documents”. - Look at the Desktop in Explorer. What is the real name? →
model.py.txt - Rename it (F2) to
model.pyand accept the “change extension” warning.
In Notepad’s Save dialog, choose All files (*.*) to prevent the extra .txt.
Lab · Step 3Create C:\actuarial_work\
- In Explorer, go to This PC → Local Disk (C:).
- New folder (Ctrl+Shift+N) → name it
actuarial_work. - Inside, create
sandbox, and inside that,dataandnotebooks. - Move the
model.pyfrom your Desktop intosandbox. - Click the address bar: confirm it reads
C:\actuarial_work\sandbox— noOneDrivein the path.
Use lowercase and underscores; no spaces. actuarial_work — not Actuarial Work. Spaces in paths cause quoting pain on the command line (Module 2).
Can’t create folders in C:\ on a locked-down work laptop? Use C:\Users\<you>\actuarial_work instead — still outside OneDrive.
Lab · Step 4Navigate without the mouse
| Keys | Action |
|---|---|
| Win+E | Open Explorer |
| Alt+D or Ctrl+L | Jump to address bar |
| Alt+↑ | Up to parent folder (..) |
| Alt+← / → | Back / forward |
| Type letters | Jump to matching item |
| F2 | Rename |
| Ctrl+Shift+C | Copy as path (Win 11) |
Challenge
- From the Desktop, reach
C:\actuarial_work\sandbox\databy typing the path. - Climb to
C:\with only Alt+↑. How many presses? - Create
notes.txtinsandboxand copy its full path to the clipboard. - Type
wtin the address bar and press Enter. (Teaser for Module 2!)
RecapModule 1 checklist
- I can explain disk vs. file system vs. Explorer
- I can read an absolute path and resolve a relative one using
.and.. - I know why
"C:\new\table.csv"breaks in Python, and three ways to fix it - I write
/in code (or usepathlib) - Extensions and hidden items are visible on my machine
- I know where
AppData,%USERPROFILE%, and~point - My workspace
C:\actuarial_work\exists, outside OneDrive
The Command Line
Everything you just did with the mouse — faster, repeatable, and scriptable, with Windows Terminal and PowerShell.