Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Avoid forward slashes in Word filenames Apps
I discovered this in MS Word, but it might apply to other X applications. I was using an old Word Perfect converted document in Word X, and when I tried to print, Word constantly and unexpectedly quit.

I realized the document's name had a date in it in this format: mm/dd/yy. Word doesn't allow forward slashes (/) in filenames anymore (although the Finder does). The document printed perfectly after I renamed it with this date format: mm-dd-yy. Is this a Windows compatibility "feature?"

[Editor's note: Anyone have any information on officially allowed filenames, either in Office or OS X in general?]
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)

Avoid forward slashes in Word filenames | 12 comments | Create New Account
Click here to return to the 'Avoid forward slashes in Word filenames' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
because of UNIX i am guessing..
Authored by: meancode on Mar 30, '02 01:14:07PM

rob, et al,

i am guessing this is because in UNIX if a forward slash (/) is encountered, it thinks that is a directory, not a file. i do find it strange how you can name things in the finder with a forward slash though. for example, TextEdit will open files with forward slashes in them. i just don't have forward slashes in file names because then i could not work with them in the terminal.

[ Reply to This | # ]
actually, it's more clever than that
Authored by: mithras on Mar 30, '02 01:32:58PM
Try the following: Make a folder in the Finder, and rename it something like "03/30/2002". Note that the Carbon Finder allows slashes (but not colons). [This is because the Carbon framework expects path separators to be colons] Then open up the Terminal, and ls the directory your folder is in. Note that to the BSD layer, your folder is named "03:30:2002". Clever, eh? [This is because when you made the folder, the Carbon framework translated the slashes, legal in Carbon, to colons, legal in BSD] But on an HFS+ disk, the filename will be stored as "03/30/2002". On a UFS disk, it would be "03:30:2002". [This is because the Virtual File System layer decides which way it's allowed to store the filename, depending on the filesystem] This was described in some depth at a WWDC session, and in a USENIX talk by Wilfredo Sanchez, the former BSD guy at Apple. None of this, of course, explains Office v.X's pigheadishness on the matter. My only guess is that instead of using Carbon calls, they're doing their own more direct manipulation, which munges things up somehow.

[ Reply to This | # ]
actually, it's more clever than that
Authored by: lezone on Mar 30, '02 07:22:45PM

Yeah, oddly enough Microsoft doesn't accept either slashes or colons.

Also I found that the Omnigroups apps (OmniGraffle, OmniOutlinr...) also don't accept either slashes or colons, but unlike MS, it automatically substitutes a dash when you try to type one of the others.


[ Reply to This | # ]
Agreed, MS apps hate /
Authored by: FACEMILK on Apr 03, '02 07:47:10PM

I once named my hard disk the single character "/" (This was in OS9 btw). This effectively added a "/" to the path of every file on the disk. Not a single app had a problem except Windows Media Player (the only MS app I was using other than IE). I can't remember if it didn't launch or couldn't play any files, but either way it was totally crippled. Changing the HD name to something else immediately fixed WMP.

Also reminds me (in the OS7 days), if you even changed the HD name (regardless of /s), MS word would be crippled and need reinstalling.

[ Reply to This | # ]
Problem Lies Elsewhere
Authored by: 128K Mac on Mar 31, '02 04:33:10AM

I suspect Jay has some problem relating to the file conversion from Word Perfect, strange as that may seem.

Word v. X will not allow you to name a file using "/" while in the application, but if you can rename it in the finder it will print with no problems. I just printed a new Word file renamed in the Finder containing four "/" characters and printed it as well as an old Word file (1989), an Excel file (1988), and a Multiplan file (1984) which all contained slashes. The three latter files were (I think) in Office 98 format when I opened them in Office X and had earlier obviously undergone one or two other conversions/upgrades.

Ever notice that Photoshop with its "save for the web" command will always change a "/" character in filename to "_" as a default? Why? That is not exactly a new command and Photoshop graphics saved with this command certainly predate the announcement of OS X. PS, btw, does not *require* you to accept the change. You can change the "_" characters back to "/".

For now.

I've read several places that the "/" character should not be used in OS X filename or dire results of some kind would occur. I finder copied (an estimated) 2,000 graphics files (out of 15,000) from OS9 to X that contained the date format of 03/01 (month, year) or 03/03/01 (day, month, year) at end of filename. I've opened and modified, etc. several hundred of these with GraphicConverter, MacGIMP, or other utils under X and seen no ill effects.

I suspect avoidance of the "/" does indeed have to do with *nix issues but that they predate OS X, but I also suspect they're somewhat obscure problems, problems that will not occur under many circumstances.

We'll see if Photoshop 7 allows me to name files with a "/." I'm guessing it *won't.* I just opened a 1997 Adobe PageMill 4.0 file renamed from index.html to i/n/d/e/x.html. Adobe GoLive 6 opened it without a hitch in OS X and printed it with no problem. But when I tried to "save as" the file it changed all the "/" to "_" and would *not* allow me to change them back to "/" ala Microsoft Office X.

/methinks OSX file names should not contain "/" but why I don't have a clue....... contribution to the confusion. :)

[ Reply to This | # ]
Re: Photoshop Save For Web
Authored by: Paul Burney on Mar 31, '02 12:47:23PM
Ever notice that Photoshop with its "save for the web" command will always change a "/" character in filename to "_" as a default?

Most Web servers won't allow slashes in filenames because on the web, a slash indicates a directory. For example, the url:

tells the server to look at the root of the server docs in a directory named one, then in a directory named two, for a file named three.html. If your file were named two/three.html the server wouldn't find it because it's looking in the non-existant directory two for it instead of in directory one.

Since "Save for Web" is supposed to make files that you can serve over the web, of course they strip out the slash. Other things to avoid in filenames on the web include percent signs (%) and pound signs (#) which each have a special meaning on the web.

Hope that helps.

[ Reply to This | # ]
Authored by: K3nt on Mar 31, '02 08:32:14AM

Here's what "MacOS X: The Missing Manual" states about file naming conventions in MacOS X.

" You can use letters, numbers, punctuation - in fact, any symbol you want except for the colon ( : ), which the Mac uses behind the scenes for it's own folder-hierarchy designation purposes."

" Note: You can't use a period or slash, either, if it BEGINS a filename."

(Own addition, .filename are unix-hidden files so, yes you can use a . as a filename start but then the end result will be a hidden file.)

Have fun!

[ Reply to This | # ]
Linux explanation
Authored by: saint.duo on Mar 31, '02 09:08:19AM

I remember a Linux using friend of me explaining it to me this way, a few years ago, when we were talking about naming files. Basically, he said that I could name a file almost anything I wanted, but if I used / or a period in the name, that I may have trouble working with the file in the command line, if I didn't watch what I was doing. He also stated that scripts that don't explicitly quote path names would have troubles with this as well. Well, the program wouldn't, but my results might. Think about the iTunes updater that killed volumes. That was due to not quoting the path in the program...

[ Reply to This | # ]
The mystery solved (?)
Authored by: eggert on Mar 31, '02 09:04:38AM

In Unix you can't have a forward slash (/) in a file name. That's it.

In Carbon applications you can, but you are in fact deceived. The forward slash (/) will be replaced by a colon (:). The (:) will show up as a forward slash (/), but if you checkin the you'll see the (:).

To avoid this confusion (most) MacOS X applications won't let you save files with either (:) or (/) in the name. These characters will be replaced with a (-).

[ Reply to This | # ]
The mystery solved (?)
Authored by: phayd on Mar 31, '02 01:59:50PM

Actually what you way is _exactly_ the opposite of the truth.

In HFS+ the directory deliminator is a colon, therefore Mac OS X replaces all colons with forward slashes for the terminal. When you type a '/' in the terminal, you are actually typing a ':', just like in Mac OS 9. This was done for POSIX compliance, and source compatibility with applications such as apache, which expect slashes, instead of colons.

Also - UNIX does not restrict the characters that you use in a filename. There is an escape character that allows the user to use any character in a filename.

Carbon apps (and cocoa apps can too, IIRC) see the directory characters for what they are: colons.

[ Reply to This | # ]
The mystery solved (?)
Authored by: garbanzito on Apr 01, '02 01:25:52AM

correct that ":" is the internal HFS+ path delimiter and that it is converted into "/" for shell/unix purposes. so "/" is a legal character in filenames from the standpoint of non-shell applications, Finder, etc., and conversely ":" is a legal character from the shell/unix standpoint.

there is quite a lot of misinformation on this issue. it's really too bad that it has to be mysterious or that people should make claims about it without actually trying it. i encourage everyone to do a few simple experiments in Finder and the shell to reinforce this knowledge.

[ Reply to This | # ]
I think it's because of Windows
Authored by: JM44236 on Mar 31, '02 07:27:47PM

IIRC, a slash is not allowed in file names on the Windows platform. Since MS has made a big deal of having transparent compatibility for Office across Mac and Windows, it makes sense that they don't allow a forbidden Windows character in a Macintosh file name.

[ Reply to This | # ]