Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

filenames that begin with "-"

Posted on 2001-08-23
8
Medium Priority
?
342 Views
Last Modified: 2010-04-21
here's a dumb question:

I have a filename that begins with a "-", like "-xyz".
I can see it with ls -la

However, I can't figure out how to remove it.
Every tool like "rm", "mv", interpret the - as a command line argument and error out.

I've tried:

rm -xyz
rm "-xyz"
rm '-xyz'
rm ?xyz
rm *xyz
rm \-xyz
rm "\-xyz"

nothing works.  My shell is tcsh if that matters.
0
Comment
Question by:red5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 28

Expert Comment

by:vinnyd79
ID: 6420380

Is it in a directory with alot of files in it?If not you can try rm -ir and say no to all files except that one.
0
 

Author Comment

by:red5
ID: 6420391
there are a lot of files.

there must be a better way.

(I was able to delete it using ftp, but that was hack - I'm just curious now...)
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 6420395

I think rm -f -xyz might do it.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 28

Accepted Solution

by:
vinnyd79 earned 200 total points
ID: 6420398
no,
actually you have to hide the file name from the command

rm ./-xyz
0
 

Author Comment

by:red5
ID: 6420400
there are a lot of files.

there must be a better way.

(I was able to delete it using ftp, but that was hack - I'm just curious now...)
0
 

Author Comment

by:red5
ID: 6420403
ya, that's it.
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 6420412
red5
did you try  this ? It will remove the file

 rm ./-xyz      
0
 

Author Comment

by:red5
ID: 6420415
ya, sorry, I had a double submit on accident...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question