Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Gregg2

macrumors 604
Original poster
May 22, 2008
7,270
1,238
Milwaukee, WI
I just discovered that Sonoma does not allow a slash (/) in a file name. I've had files with a slash for many years without any problem. When I went to open such a file in Excel, an error came up saying the file could not be found. On a hunch, I removed the slash, and the file opened. Just a head's up for anyone who might be scratching theirs.;)
 

thebart

macrumors 6502a
Feb 19, 2023
515
518
I'm surprised it was allowed in the first place. I guess it could be escaped like other special chars. And you can't do that any more?
 

monokakata

macrumors 68020
May 8, 2008
2,063
605
Ithaca, NY
I duplicated an Excel file, dropped a slash in a space -- Excel opened it up but shows ":" where the slash should be. If I just save it (having made a small change) all's well.

If I try to save it with a new name, Sonoma says "you do not have permission to save files to this location."

Maybe it's interpreting the slash as a path symbol?
 
  • Like
Reactions: chabig

zevrix

macrumors 6502
Oct 10, 2012
406
230
I'm surprised it was allowed in the first place.

I guess Apple didn't have a choice but to allow to use forward slash (/) in the file names for backward compatibility when they released OS X. Mac users already had countless files with forward slashes in their name that were created on "classic" Mac OS.

As you probably know, on classic Mac OS forward slash didn't have any special meaning and could be used with no issues — while on OS X it's the path separator for Unix (POSIX) paths.

While forward slash is indeed allowed in file names, it should NEVER be used. Using it is only asking for trouble (as I'm sure people here know anyway).
 
  • Like
Reactions: twanj

zevrix

macrumors 6502
Oct 10, 2012
406
230
I duplicated an Excel file, dropped a slash in a space -- Excel opened it up but shows ":" where the slash should be. If I just save it (having made a small change) all's well.

If I try to save it with a new name, Sonoma says "you do not have permission to save files to this location."

Maybe it's interpreting the slash as a path symbol?

When you use a slash in the file name, the actual file name doesn't contain the slash. Only displayed name (that is, the name you see in the Finder) contains the slash. The actual file name contains a colon [:].

Users have never been allowed to use colon in file names on Mac because it was - and still is - the path separator in HFS paths. So by using the illegal colon in the file name when you enter a slash, the system knows that the slash was entered by the user — and will interpret the colon accordingly.

Slash is the file separator in the Unix (POSIX) paths - which are the primary path types ever since OS X. Even though it's allowed in file names (for the reasons I explained in my post above), forward slash should NEVER be used in file names. Sooner or later it WILL cause problems - as you witness from this thread.

Many software titles may interpret forward slash for what it is - the path separator - which will lead to errors and other major headaches.
 
Last edited:
  • Like
Reactions: twanj

chabig

macrumors G4
Sep 6, 2002
11,449
9,320
macOS file names have been consistent since the introduction of OS X in 2001. Nothing has changed. Here is the ultimate guide to naming folders and files.

 
  • Like
Reactions: twanj

zevrix

macrumors 6502
Oct 10, 2012
406
230
I just discovered that Sonoma does not allow a slash (/) in a file name. I've had files with a slash for many years without any problem. When I went to open such a file in Excel, an error came up saying the file could not be found. On a hunch, I removed the slash, and the file opened. Just a head's up for anyone who might be scratching theirs.;)

Sonoma still allows to enter slash in file names (although ideally they should never be used, as I described above). I guess a new Excel update has done away with supporting the deciphering of slashes in file names - and now only treats them as path separators, which leads to an error if the slash is used in a file name.

P.S. I think that Apple should do a better job in preventing users from using forward slashes in file name (maybe show a warning every time an attempt to insert a forward slash is made). Would be a rare case when a warning would be justified - compared to countless warnings macOS now bombards the users with for no reason.
 
  • Like
Reactions: twanj

Gregg2

macrumors 604
Original poster
May 22, 2008
7,270
1,238
Milwaukee, WI
Thanks for all the replies. To clarify, I got the reported error when trying to open a file with / in the name that had been created prior to the upgrade to Sonoma. Since I just upgraded, I assumed that was the culprit. This happened for three "old" files. I have not attempted to create a new file with a / in the name. But if that still works, then it's strange that these three files would not open until the / was removed.

The error message also suggested causes: that the file had been renamed or moved. But I knew that neither of these were possibilities.
 
  • Like
Reactions: twanj

zevrix

macrumors 6502
Oct 10, 2012
406
230
The error message also suggested causes: that the file had been renamed or moved. But I knew that neither of these were possibilities.

It's most likely because Excel believes that your file named "file/name.xlsx" is in fact a file "name.xlsx" located in the folder "file". Hence the suggested error causes.

Like I mentioned, the handling of slashes in the file name can vary between different apps as well as their versions and specific functions in the app. If developers forgot - or didn't want to - check for the special case of slashes in the file name, then the slashes will be interpreted as path separators with corresponding consequences.

And then there's a separate set of problems if you attempt to use such files on the web, FTP, cloud storages etc. So it's better to never use slashes.
 

Gregg2

macrumors 604
Original poster
May 22, 2008
7,270
1,238
Milwaukee, WI
But it’s curious that these files opened promptly through all previous OS upgrades. Something changed in Sonoma.

My files were just on my Mac, so the use of slashes in the filenames wasn’t ever a problem.
 
  • Like
Reactions: twanj

zevrix

macrumors 6502
Oct 10, 2012
406
230
But it’s curious that these files opened promptly through all previous OS upgrades. Something changed in Sonoma.
My files were just on my Mac, so the use of slashes in the filenames wasn’t ever a problem.

Oh yeah something changed. Either in Excel or Sonoma or both.

That's why it's best to never use slashes as they work only until they don't.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.