removing a file with hyphens

Paul Orrock paulo at digitalcraftsmen.net
Thu Jun 7 11:32:28 BST 2007


Hi,

So for reasons I won't go into I ended up with a file like this

-rw-r--r--   1 paulo paulo       0 2007-05-21 14:23 -----Original

which I didn't want, so I tried the following :

paulo at kryten:~$ rm *riginal
rm: unrecognised option `-----Original'
Try `rm --help' for more information.
paulo at kryten:~$ mv '\-\-\-\-\-Original' old
mv: cannot stat `\\-\\-\\-\\-\\-Original': No such file or directory
paulo at kryten:~$ mv '-----Original' old
mv: unrecognised option `-----Original'
Try `mv --help' for more information.
paulo at kryten:~$ mv \-\-\-\-\-Original old
mv: unrecognised option `-----Original'
Try `mv --help' for more information.
paulo at kryten:~$ mv "\-\-\-\-\-Original" old
mv: cannot stat `\\-\\-\\-\\-\\-Original': No such file or directory
paulo at kryten:~$ rm '\-\-\-\-\-Original'
rm: cannot remove `\\-\\-\\-\\-\\-Original': No such file or directory

Then I tried unlink('-----Original') using perl and it worked fine.

I'm glad that it did but I'm curious as to why ?

My second question is how do non perl people do it ?

So I thought I would ask you brainy people :-)

Regards,

Paul




More information about the london.pm mailing list