LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 03-01-2008, 04:53 PM   #1
harry edwards
Member
 
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
Removing a directory beginning with a minus sign.


Leap year got me!

Some buggy software has managed to create the following folders:

drwxr-xr-x 2 bian users 8496 Mar 1 04:03 -2606
drwxr-xr-x 2 bian users 8496 Mar 1 04:00 -2700
drwxr-xr-x 2 bian users 8496 Mar 1 04:00 -2706
drwxr-xr-x 2 bian users 5168 Mar 1 04:00 -2712

I've tried to remove them but can't!

rm -rf "-2606/"
rm: invalid option -- 2

rm -rf '-2606/'
rm: invalid option -- 2

What am I doing wrong?

P.S I am using Suse 8
 
Old 03-01-2008, 05:10 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Try deleting them in Nautilus or Konqueror.

--------------------
Steve Stites
 
Old 03-01-2008, 05:22 PM   #3
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
This has come up on the forums before. Do this: rm -rf ./-blah
 
Old 03-01-2008, 05:29 PM   #4
harry edwards
Member
 
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Original Poster
Rep: Reputation: 48
Thank you. Worked a treat!
 
Old 03-01-2008, 05:44 PM   #5
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Glad you got it working - this is just extra info...

Several commands support using "--" to separate options and arguments. In this case you could also have used:
Code:
rm -rf -- -2606
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set up single sign on with apache with Active directory Braytac Linux - Software 1 11-08-2007 05:54 PM
How do I write a script to copy all files beginning with A to a directory named 'a'. AwesomeMachine Linux - Newbie 2 06-01-2007 10:24 AM
Removing beginning of line with a shell script oscarlevin Programming 9 05-07-2007 01:18 AM
Single Sign-On to Active Directory camshere Linux - Software 6 12-11-2006 06:46 AM
how to delete file which name start with minus sign? guillaume31 Linux - General 3 01-27-2005 07:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:16 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