LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 09-24-2013, 06:42 PM   #1
Corrado
Member
 
Registered: Aug 2004
Location: Washington
Distribution: RHEL 5.0
Posts: 135

Rep: Reputation: 16
Removing odd file name


I have a problem and haven't been too successful in resolving.

There is a file with the name '--remove-files' that I am trying to remove from a directory.

Any suggestions on how to do this? I am using the bash shell.

Code:
-rw-r--r--   1 root     root  3464407040 Jan 22  2011 --remove-files
 
Old 09-24-2013, 06:53 PM   #2
suicidaleggroll
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 2,426

Rep: Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890
Stick a ./ in front of it, or give the full path to the file
Code:
rm ./--remove-files
 
Old 09-24-2013, 07:01 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,543
Blog Entries: 51

Rep: Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606
Quote it, escape it (backslashes) or end rm options with "--"?
 
Old 09-24-2013, 07:13 PM   #4
suicidaleggroll
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 2,426

Rep: Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890
Quoting and escaping don't work, FYI

Found that out when I was trying to just create the file to test removing it.
 
Old 09-24-2013, 07:46 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,543
Blog Entries: 51

Rep: Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606Reputation: 2606
Well OK then, quoting and end options with "--":
Code:
]$ touch -- "--remove-files"
]$ file -- "--remove-files"
--remove-files: empty
]$ rm -f -- "--remove-files"
;-p
 
Old 09-24-2013, 10:09 PM   #6
suicidaleggroll
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 2,426

Rep: Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890
lol

"--" to end options is a good one
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Agora.iso: odd file. stf92 General 7 07-24-2012 01:06 AM
[SOLVED] Removing odd characters from CSV files using a script? carbo Programming 7 04-28-2010 02:42 AM
Really Odd Hidden File Jared Lewis Slackware 15 12-23-2008 05:54 PM
odd entry in /etc/passwd file globeTrotter Linux - Security 4 07-21-2004 09:27 PM
File descriptors odd question ferreter Linux - General 2 02-13-2003 10:21 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration