Skip to content
Tutorials Center
My learning

Topics

Lesson 42 of 55 ยท Working with Computers

Files, Folders and Staying Organized

Learn how paths and extensions work, how to name and organize files, search effectively, compress and share them, and avoid the common pitfalls of cloud sync.

A computer can hold hundreds of thousands of files, and the difference between finding the right one in five seconds and losing twenty minutes is mostly a matter of habits. Good organization is not about being tidy for its own sake; it saves time, prevents accidents such as overwriting the wrong version, makes backups simpler and makes it easy to share your work with other people.

This lesson is the practical side of file systems. You already know how a file system stores files on disk from File Systems; here you learn to read a path, understand extensions, choose names and folder structures that last, search effectively, compress and share files, and work safely with cloud-synced folders. The two stand-ins are a path parser and a file-name normalizer.

Files, folders and paths

A file holds data and has a name. A folder (also called a directory) holds files and other folders, which form a tree. The location of a file in that tree is its path.

  • On Windows, a path starts with a drive letter and uses backslashes: C:\Users\Mia\Documents\report.pdf.
  • On macOS and Linux, a path starts at the root / and uses forward slashes: /home/mia/documents/report.pdf.
  • A path starting from the root is absolute: it is complete and means the same thing anywhere. A relative path starts from the current folder: documents/report.pdf. Two dots, .., mean "the parent folder".
  • A home folder (C:\Users\Mia, /Users/mia, /home/mia) is where your own documents, downloads and settings live. Everything inside it belongs to you; system folders do not.

The last part of the path is the file name. Everything before it is the list of folders to open, one after another.

flowchart TD
  H["home (mia)"] --> D["Documents"]
  H --> P["Pictures"]
  D --> W["Work"]
  D --> S["School"]
  W --> R["2025-03_budget.xlsx"]
  P --> T["2025-03-14_holiday.jpg"]

A folder tree: the path to the budget is home / Documents / Work / 2025-03_budget.xlsx.

The stand-in below splits a path into its parts, guessing the style from the separators. It is a simplified teaching version: real programs use the platform's path library, which also handles special cases such as network shares and ...

JS A path parser

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Notice that only the text after the last dot counts as the extension: holiday.tar.gz is a .gz file which, once opened, contains a .tar archive. Names that begin with a dot, like .bashrc, are conventionally hidden files on macOS and Linux and have no extension.

Extensions and file types

An extension is the short suffix after the last dot, such as .txt, .jpg or .pdf. Operating systems use it as a hint for which program opens the file and which icon to show. Remember:

  • The extension is only a label. Renaming photo.jpg to photo.png does not convert it; it just makes programs look at it wrongly. To change a format, open the file in a program and use "Save as" or "Export". The content decides the real type, as explained in Compression and File Formats.
  • Hidden extensions are a risk. Windows and macOS can hide extensions by default, which lets invoice.pdf.exe look like invoice.pdf. Turn on "show file name extensions" in your file manager and treat unexpected .exe, .scr, .bat, .js or .msi files in an email as suspicious (see Malware, Phishing and Safe Habits).
  • Some formats are better for a long time or for sharing: text (.txt, .md), .pdf for finished documents, .csv for tables, .png or .jpg for pictures, .mp3 or .mp4 for audio and video. Open, widely supported formats are easier to read in twenty years than a program's private format.

Naming files well

Good names are the cheapest form of organization. A name should tell a future reader, who may be you in a year, what the file is without opening it. Useful conventions:

  1. Be descriptive and specific. budget-2025-draft.xlsx beats new1.xlsx.
  2. Put dates in ISO form, year first: 2025-03-14. Then an alphabetical sort is also a chronological sort. Writing 03-14-2025 or 14.3.25 breaks that.
  3. Use a consistent separator. Hyphens or underscores in place of spaces avoid trouble in links and on command lines. Pick one style and keep it.
  4. Avoid special characters. Some systems forbid \ / : * ? " < > | in names, and symbols like #, % or & cause problems in web addresses. Letters, digits, hyphens and underscores are always safe. Accented letters and emoji generally work in modern systems but can break in older tools.
  5. Keep names reasonably short, but do not shorten so much that meaning is lost. Many systems limit a path's total length.
  6. Do not name versions "final". report-final-FINAL-v2.docx will eventually fight report-final-really.docx. Use numbers (v1, v2) or dates, and keep only a few older versions, or use a tool built for versions.
  7. Mind capitalization. Windows treats Report.PDF and report.pdf as the same name; Linux treats them as different files. Lowercase names avoid surprises when files move between systems.

The next stand-in turns messy names into a clean, consistent form: lowercase, accents removed, anything unsafe replaced with a hyphen, the extension lowercased and an ISO date added in front.

JS A file-name normalizer

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Programs that rename in bulk (many file managers and command-line tools can) use exactly this kind of rule, so always preview the result and keep a copy before renaming a lot of files.

Folder structure

A folder structure is a map of your life or work. Principles that work for most people:

  • Few levels, clear names. Aim for two to four levels. Too deep and nothing is findable; too flat and one folder holds thousands of files.
  • Organize by what you will think of when you look for it. Common top levels: by project (Website-Redesign), by area (Finance, Health), or by time (2025). Pick one main axis and use it consistently. Photos are often by date (2025/2025-03-holiday), work documents by project.
  • Separate current from finished. An Archive folder keeps old projects out of the way without deleting them.
  • One home for each thing. If the same file lives in two places, you will edit one copy and lose track of which is newest. Prefer shortcuts or links.
  • Do not use the Desktop or Downloads as storage. They collect clutter. Process Downloads regularly: move what you keep, delete the rest.
  • Keep your own data apart from programs. Data in your own folders is easy to back up. See Backups and Data Recovery.

Good names and folders help, but search is the fastest tool when you have many files.

  • Every operating system indexes file names (and often contents) so that searching is quick: Windows Search, macOS Spotlight, and find or locate on Linux.
  • Search by name part (budget), extension (*.pdf or kind:pdf), date (modified last week) and size (larger than 100 MB). Combining a type and a date range cuts thousands of results to a few.
  • Use sorting and views in the file manager: sort by date modified to find what you worked on today, or by size to find what fills the disk.
  • Searching inside documents (full-text search) finds a phrase you remember, but depends on the index being up to date.

Compressing and sharing

To send many files at once, put them into one archive. A .zip file bundles files and compresses them (see Compression and File Formats), and every major system can create and open ZIP files without extra software. Others you may meet: .7z (small, needs a program), .tar.gz (common on Linux). Text, documents and spreadsheets shrink a lot; JPEG pictures, MP4 videos and files that are already compressed shrink hardly at all.

When sharing:

  • Check the size limit. Email attachments are often limited to around 20 to 25 MB, and the encoding makes messages about a third bigger. For large files, send a link from a cloud storage service instead.
  • For a link, choose permissions deliberately: view or edit, specific people or "anyone with the link". Anyone who gets a public link can forward it.
  • Remove what you do not mean to share: hidden metadata (author, location in photos, tracked changes in documents) can reveal more than the visible content.
  • For a final document, share a .pdf so the layout looks the same everywhere.
  • Protect sensitive archives with a password or encryption, and send the password by a different channel than the file (see Passwords, Hashing and Encryption).

Cloud sync pitfalls

Cloud storage services keep a special folder and copy changes to every device (see Email, the Cloud and Everyday Online Services). Convenient, but with traps:

  • Sync is not backup. If you delete a file or ransomware encrypts it, the change is synced everywhere. Keep real backups too.
  • Conflicts. If you edit the same file on two devices while offline, the service often keeps both and adds "conflicted copy" to one name. Look for these and merge the changes by hand.
  • Files on demand. Many services show files that are not actually on your disk until you open them. Without internet they are unavailable. Mark important files "always keep on this device" before a trip.
  • Moving the folder or renaming it while syncing can confuse the service. Use its own settings to change the location.
  • Names that differ between systems. A name that is fine on Linux can be rejected on Windows (trailing dots, forbidden characters), and names differing only in capitalization can collide. Your simple naming habits avoid these problems.
  • Do not put live databases or program folders in a synced folder; half-written files get uploaded.
  • Check the free space of both the cloud account and your disk. A full account quietly stops syncing.

What is real here and what is a stand-in? Paths, extensions, ISO dates, naming rules, archives and sync behavior are real everyday practice. The path parser and normalizer are small JavaScript teaching versions: real systems also handle drive letters on other volumes, network paths, symbolic links, Unicode normalization differences between systems and many other edge cases.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What is the file extension of holiday.tar.gz?

    The extension is whatever follows the last dot. The .gz file contains a .tar archive, but its own extension is gz.
  2. 2. Which date format in a file name sorts alphabetically in time order?

    Year first, then month, then day, with zero padding, makes the alphabetical order the same as the chronological order.
  3. 3. You rename photo.jpg to photo.png. What happens to the picture?

    An extension is only a label. To change format, open the file and export or save it in the new format.
  4. 4. Why is cloud sync not a backup?

    Sync mirrors the current state. If the state is bad (deleted, encrypted, overwritten), every device receives the bad state.
  5. 5. What does the absolute path /home/mia/documents/report.pdf tell you that documents/report.pdf does not?

    An absolute path starts at the root and is complete; a relative path depends on which folder you are in.

Summary

  • A path is the chain of folders leading to a file; absolute paths start at the root or drive, relative paths from the current folder.
  • The extension is the text after the last dot and is only a hint; show extensions to avoid disguised executables.
  • Name files descriptively, use ISO dates (YYYY-MM-DD), consistent separators, safe characters and version numbers instead of "final".
  • Keep folder trees shallow and clear, organized along one main axis, with an archive for finished work and one home for each file.
  • Use search with name, type, date and size filters; the operating system's index makes it fast.
  • Zip many files together, mind size limits and sharing permissions, and remove hidden metadata.
  • Cloud sync mirrors mistakes, can create conflicted copies and may keep files online only; it complements, but does not replace, backups.

Next, learn to work with the keyboard instead of the mouse: The Command Line: First Steps.