Posts Tagged ‘path’

cd into, or make a directory beginning with a leading “-”

Saturday, April 12th, 2008

Having ZFS and SAMBA on the home machine is great. It was simple to set up a share and offer it out to my house mates for them to backup their dissertation work on. With ZFS compressing the files, some of my file systems are getting a 1.6x ratio (60% disk space for free compared with a non-compressing file system)

The interesting bit comes with file permissions and Windows file attributes which aren’t quite the same, in fact, not at all. The attributes get mapped onto the unix file permissions in an interesting way, and you’ll need to keep that in mind when ls -l ing around a shared directory.

Meanwhile, there was a directory named “—-FILES—-” on the share. Trying to use

cd "----FILES----"

doesn’t quite work! Despite quoting the directory name, cd still tries to take some of those dashes as a switch. I’m not sure if theres a way around this using the relative path, but there is a different workaround: simply use the absolute path, instead of a relative one to get you there, eg:

cd /mydir/----FILES..../

To make a directory with leading dashes, you’ll need to specify the full pathname, or use something like this to make the process less painful:

mkdir `pwd`/--mydir--