Last week, a colleague asked me why can’t we use “slash” -> “/” and some other special symbols when we’re naming files on Windows? So let’s talk about that today!
In this article, I try to make things easy to understand for people who are not familiar with computers so for advanced users the explanations might seem incomplete.
How your computer accesses data?
All Operating Systems (OS) are using a file system typically for Windows it’s NTFS (FAT32 in the past), for MacOS, it’s HFS+ (HFS in the past). And those file systems use the concept of files and directories to access data stored on a device (hard drives, SSD, Flash drives etc…) and they follow the same general naming conventions. For an individual file: a base filename and an optional extension, separated by a period such as: “MyPhoto.jpg”. All those files are stored in folders -yes even the ones you stored on the desktop are in a folder called “Desktop” in your hard drive or SSD.
When you’re thinking of files and folders you have to imagine your file system in your hard drive is like a tree:
Your hard drive is the trunk of your tree, it’s the first folder, in Windows, it’s usually associated with a Drive letter called “Volume designators” “C:” if it’s the system hard drive or “D:” if it’s the second hard drive on your computer. On MacOS, it’s “Macintosh HD” also know as “disk1” in Disk Utility 😉. Then come subfolders such as on Windows: “Users”, “Program Files”, “Windows”… and each of these folder contains other subfolders. It’s like the branches of a tree.
On Windows we use “back-slash” -> “\” and on MacOS “slash” -> “/”to represent directories or path to a file so for the precedent example it’s gonna be:
“C:\Users\Francis\Pictures\MyPhoto.jpg” for Windows “/Users/Francois/Pictures\MyPhoto.jpg” for MacOS
So now you know why “/” and “\” can’t be used in windows for filenames. On MacOS, the OS is more permissive and it allows you to use symbols that Windows doesn’t.
Also, there are some other characters you can’t use because they are reserved by the system and it goes the same for some filenames that can’t be given. For a complete list refer to your OS documentation.
When naming a file for your OS there is no difference between “PHOTO.jpg”, “Photo.jpg” and “photo.jpg” we say the filesystem is non-case sensitive. Natively Windows and MacOS consider these 3 filenames as the same, even if it’s actually false to say that. I know it’s quite confusing! But in fact, they can make the difference and it’s due to the fact that those OS are working with something called “POSIX semantics” and it gives them the ability to understand the difference between those 3 filenames.
Also there 4 rules to keep in mind, and especially now that we are more and more working with internet and file-hosting and webmails.
If you plan to share files over the internet you might consider to:
- Avoid spaces between words in your filenames and replace them with dash “-“
- Avoid special symbols such as: &, é, à…
- Keep your filenames to a reasonable length and be sure they are under 31 characters.
- Most operating systems are case sensitive; always use lowercase.
You may be wondering why? Because what you see is not what your web browser sees and when you download a file it might change the filename.
Web Browser sees: “Q&A%20September.html”
“my PDF file#name.pdf”
Web Browser sees: my%20PDF%20file%23name.pdf
So when you’re downloading the file on your computer you will end up with a file named: my%20PDF%20file%23name.pdf. Not very user-friendly isn’t it?!