SUMMARY: Remove or rename a file

From: Safdar Mirza (safdarm@gmail.com)
Date: Thu Mar 02 2006 - 17:39:21 EST


My sincere apology to those who suggested that I should not post a unix
related question to Solaris Sun Manager list.

Special thanks to *Richard Lacroix, Scott Fendley, Simon Burr, Lineberger,
Aaron., Bill R. Williams, Thomas M. Payerle, Alexandre Wanderley *Following
solutions were provided.

My original question.

Hi Sun Mgr -

This seems like a very simple problem but I can not find a solution for
this. After reading several man pages, trying google and different options
I finally decide to ask.

I have few files that start with - as file name. I want to rename them but I
can not find a simple solution. File are listed as follows:

-work.file01

-work.file02

-work.file03

cp or mv or even ls does not work as all commands assume that - is a flag
and not a file name. I have tried double quote "", single quote ''. or
even backslash \ before the - character but none of them work. Any
other ideas? Thanks.

:) Safdar

http://www.safdar.com

And answer to my question:

ls - -work*
mv - -work.file01 work.file01

rm - -work.file01

mv ./-work.file01 work.file01

rm -- -work.file01

--
Safdar Mirza
http://www.safdar.com
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:39:11 EDT