Apple - How do I create a symbolic link to a directory with a space in it?
The quote marks are preventing ~
from being expanded to your home folder, so you need to either quote just the part with the space in it:
ln -s ~/"Foo Bar/" Foo
Note: exactly how much is quoted doesn't matter, as long as the space is in the quoted portion and the ~/ isn't. ~/Foo" "Bar/
, ~/"Foo Bar"/
, ~/Fo"o B"ar/
etc are all equivalent. Also, single- and double-quotes have the same effect on spaces (although they differ on other characters), so ~/'Foo Bar/'
, ~/Foo' 'Bar/
etc would also work.
You could also use an escape to prevent the space from being treated as a separator:
ln -s ~/Foo\ Bar/ Foo