mv file with illegal character

Enno Davids enno at doc.metva.com.au
Mon Apr 21 20:15:07 PDT 2003


On Tue, Apr 22, 2003 at 12:38:23PM +0930, Greg 'groggy' Lehey wrote:
|On Monday, 21 April 2003 at 12:09:15 -0400, Jim Weeks wrote:
|> This isn't a really a freebsd question, but I can't seem to find the answer
|> to this elsewhere.  I imagine that some of you may have come across the
|> same situation.
|>
|> One of my clients has renamed a directory -backup and now she can't do a
|> thing with it.  Any command seems to pickup the -b as an option rather
|> than part of the name.  I've tried *backup and still the illegal option
|> error occurs.
|>
|> Any ideas? 
|
|Strangely, nobody else answered this: use ./-backup.  . is the current
|directory, so ./filename is the same as filename for any value of
|"filename".

Perhaps no one answered becasue the man page also has the answer... I quote:

> The rm command uses getopt(3) to parse its arguments, which allows it to
> accept the `--' option which will cause it to stop processing flag
> options at that point.  This will allow the removal of file names that
> begin with a dash (`-').  For example:
> 	rm -- -filename
> The same behavior can be obtained by using an absolute or relative path
> reference.  For example:
> 	rm /home/user/-filename
> 	rm ./-filename


Cheers,

Enno.





More information about the freebsd-isp mailing list