LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-17-2006, 04:19 AM   #1
vtrac
LQ Newbie
 
Registered: Jun 2005
Posts: 5

Rep: Reputation: 0
Can't delete a file that starts with -


I've somehow created a file that starts with a '-' and I can't seem to do anything to it. The file is "-backup_log.log", and everytime I try to delete it, move it, vi it, the command thinks it's a unrecognized flag:

Quote:
# mv "-hm_backup_log.log" asdf.log
mv: invalid option -- h
Try `mv --help' for more information.
I've tried quotes, escaping the -, etc. Any ideas?
 
Old 04-17-2006, 04:25 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Iyou have mc installed use it to delete the file.
 
Old 04-17-2006, 04:39 AM   #3
vivek reddy
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore, India
Distribution: RHEL-4, fedora core 3, SLES-9,ubuntu 5.1
Posts: 22

Rep: Reputation: 15
in case you do not have mc installed.

you can copy the file to a temp directory and delete the whole directory. use the absolute path. i just tried, it worked. if anyone has a easier method, please help..
 
Old 04-17-2006, 05:21 AM   #4
guedellas
Member
 
Registered: Dec 2005
Location: Espaņa
Distribution: Fedora Core 8 + Debian 4.0 + Vista
Posts: 61

Rep: Reputation: 15
I guess that rm ./-hm_backup_log.log should solve your problem
 
Old 04-17-2006, 05:25 AM   #5
vtrac
LQ Newbie
 
Registered: Jun 2005
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by guedellas
I guess that rm ./-hm_backup_log.log should solve your problem
Brilliant. I don't know why I didn't think of that. Thanks.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
delete file newblinx Linux - Newbie 1 04-20-2005 10:11 PM
Program starts from command line but not from file browser lasindi Programming 3 07-25-2004 07:34 AM
Tried to delete file as root but it says I don't have permission to delete it! beejayzed Mandriva 23 03-12-2004 02:46 AM
Delete contents of the file, but not file? mikeshn Linux - General 9 05-28-2003 06:47 AM
file delete emperor13 Linux - General 1 12-06-2001 09:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration