Next: File Name Cache, Previous: Remote Files, Up: Files [Contents][Index]

### 18.15 Quoted File Names

You can quote an absolute file name to prevent special characters and syntax in it from having their special effects. The way to do this is to add ‘`/:`’ at the beginning.

For example, you can quote a local file name which appears remote, to prevent it from being treated as a remote file name. Thus, if you have a directory named `/foo:` and a file named `bar` in it, you can refer to that file in Emacs as ‘`/:/foo:/bar`’.

‘`/:`’ can also prevent ‘`~`’ from being treated as a special character for a user’s home directory. For example, `/:/tmp/~hack` refers to a file whose name is `~hack` in directory `/tmp`.

Quoting with ‘`/:`’ is also a way to enter in the minibuffer a file name that contains ‘`$`’. In order for this to work, the ‘`/:`’ must be at the beginning of the minibuffer contents. (You can also double each ‘`$`’; see File Names with $.)

You can also quote wildcard characters with ‘`/:`’, for visiting. For example, `/:/tmp/foo*bar` visits the file `/tmp/foo*bar`.

Another method of getting the same result is to enter `/tmp/foo[*]bar`, which is a wildcard specification that matches only `/tmp/foo*bar`. However, in many cases there is no need to quote the wildcard characters because even unquoted they give the right result. For example, if the only file name in `/tmp` that starts with ‘`foo`’ and ends with ‘`bar`’ is `foo*bar`, then specifying `/tmp/foo*bar` will visit only `/tmp/foo*bar`.