X

Managing files with forward slashes in their names

OS X restricts the use of forward slash characters in file names; however, there may be rare instances where forward slashes can find their way into file names and result in OS X not being able to interact with the file.

Topher Kessler MacFixIt Editor
Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.
Topher Kessler
2 min read

In the classic Mac OS, colon characters were used to separate folders in a file path, but in Unix-based systems the folder separator is a forward slash character. These characters are prevented from being used in file names because it would confuse the system when trying to access the file. When Apple developed OS X, the use of the forward slash was adopted because of its Unix underpinnings, so in OS X you cannot include a true forward slash in a file name.

This may cause some confusion, since in the Finder you can rename files to include a forward slash; however, this is because the Finder converts forward slashes into colon characters when writing the names to disk. The colon character is fine for use in Unix file names, but the forward slash is not.

Therefore, despite potential confusion by the Finder's character conversions, the real limitation in OS X is the use of forward slashes in the actual name of files, which makes sense because this would cause programs to interpret the file as being within a directory. Despite this, there may be rare instances where forward slashes might end up in file names.

In a relatively lengthy Apple Discussion posting, one user ran into this problem with a file appearing in his trash folder that could not be removed because it contained a forward slash character in its name. Practically no utility could access it, since all of them interpreted the slash to be a folder path instead of a part of the file name.

The occurrence of this type of problem is very rare, and likely would happen from the use of alternative operating systems in Boot Camp or other setups that allow them to directly access and write to the Mac's hard drive (without the Mac OS loaded and running). In this setup, if the alternative operating system has no file name restrictions for the forward slash character, then the character may be written to the Mac's disk without any conversion such as the Finder converting a slash to a colon character.

If you run into this problem, unfortunately there will be almost nothing you can do within OS X to target the file either for removal or for renaming. Therefore, the only way to remove it will be to access the file using an operating system that does not have a special use for the forward slash character, such as Windows. Boot into Windows, install a tool for reading and writing to HFS+ formatted drives, and then locate the file on the OS X disk and remove it.



Questions? Comments? Have a fix? Post them below or email us!
Be sure to check us out on Twitter and the CNET Mac forums.