|
Home > Archive > Red Hat General > January 2004 > Cannot remove symbolic link ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Cannot remove symbolic link ?
|
|
|
| I have created a few symbolic links to various directories in the root
directory and now wish to remove them, unfortunately I can seem to do so.
If I use rm (as root) without options I get "can not remove directory", So
I try rmdir and I get "... not a directory", rm -f and rm -d also do not
work. What am I doing wrong?
[root@CAGE /]# mkdir /documents/foobar
[root@CAGE /]# ln -s /documents/foobar foobar
[root@CAGE /]# ls -l foo*
lrwxrwxrwx 1 root root 24 Dec 29 02:41 foobar ->
/documents/foobar/
[root@CAGE /]# rm foobar/
rm: cannot remove directory `foobar/': Is a directory
[root@CAGE /]# rm -f foobar/
rm: cannot remove `foobar/': Not a directory
# Didn't think this would work but tried anyway
[root@CAGE /]# rmdir foobar/
rmdir: `foobar/': Not a directory
--
Remove underscores from email address to respond
| |
| Alexander Dalloz 2004-01-23, 7:12 pm |
| On Mon, 29 Dec 2003 09:38:41 +0000 sj wrote:
quote:
> I have created a few symbolic links to various directories in the root
> directory and now wish to remove them, unfortunately I can seem to do so.
> If I use rm (as root) without options I get "can not remove directory", So
> I try rmdir and I get "... not a directory", rm -f and rm -d also do not
> work. What am I doing wrong?
>
>
> [root@CAGE /]# mkdir /documents/foobar
> [root@CAGE /]# ln -s /documents/foobar foobar
> [root@CAGE /]# ls -l foo*
> lrwxrwxrwx 1 root root 24 Dec 29 02:41 foobar ->
> /documents/foobar/
>
> [root@CAGE /]# rm foobar/
> rm: cannot remove directory `foobar/': Is a directory
>
> [root@CAGE /]# rm -f foobar/
> rm: cannot remove `foobar/': Not a directory
>
> # Didn't think this would work but tried anyway
> [root@CAGE /]# rmdir foobar/
> rmdir: `foobar/': Not a directory
rm -rf /foobar
Alexander
--
Alexander Dalloz | Enger, Germany
PGP key valid: made 13.07.1999
PGP fingerprint: 2307 88FD 2D41 038E 7416 14CD E197 6E88 ED69 5653
| |
|
| Alexander Dalloz wrote:
quote:
> On Mon, 29 Dec 2003 09:38:41 +0000 sj wrote:
>
>
> rm -rf /foobar
>
> Alexander
>
>
Thanks for the suggestion. 'rm -rf /foobar' also complained about not being
able to remove a non directory. However on a whim a tried a regular
expression 'rm -rf /foob*' and BINGO! Actually using the regular
expressions I don't need the options, 'rm /foob*' worked fine.
Weird, not at all sure whats going on here, but hey it works.
--
Remove underscores from email address to respond
| |
| Paul Colquhoun 2004-01-23, 7:13 pm |
| On Mon, 29 Dec 2003 09:38:41 GMT, sj <_jones57_@swbell.net> wrote:
| I have created a few symbolic links to various directories in the root
| directory and now wish to remove them, unfortunately I can seem to do so.
| If I use rm (as root) without options I get "can not remove directory", So
| I try rmdir and I get "... not a directory", rm -f and rm -d also do not
| work. What am I doing wrong?
|
|
| [root@CAGE /]# mkdir /documents/foobar
| [root@CAGE /]# ln -s /documents/foobar foobar
| [root@CAGE /]# ls -l foo*
| lrwxrwxrwx 1 root root 24 Dec 29 02:41 foobar ->
| /documents/foobar/
|
| [root@CAGE /]# rm foobar/
| rm: cannot remove directory `foobar/': Is a directory
|
| [root@CAGE /]# rm -f foobar/
| rm: cannot remove `foobar/': Not a directory
|
| # Didn't think this would work but tried anyway
| [root@CAGE /]# rmdir foobar/
| rmdir: `foobar/': Not a directory
Have you tried:
rm foobar
*without* the trailing '/'?
Generally, the trailing slash is a directory marker, and you are trying
to delete a link, not a directory. It may be confusing the file selection
code.
--
Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/~paulcol
Asking for technical help in newsgroups? Read this first:
http://catb.org/~esr/faqs/smart-questions.html#intro
| |
|
| Paul Colquhoun wrote:
quote:
> On Mon, 29 Dec 2003 09:38:41 GMT, sj <_jones57_@swbell.net> wrote:
> | I have created a few symbolic links to various directories in the root
> | directory and now wish to remove them, unfortunately I can seem to do
> | so. If I use rm (as root) without options I get "can not remove
> | directory", So
> | I try rmdir and I get "... not a directory", rm -f and rm -d also do
> | not
> | work. What am I doing wrong?
> |
> |
> | [root@CAGE /]# mkdir /documents/foobar
> | [root@CAGE /]# ln -s /documents/foobar foobar
> | [root@CAGE /]# ls -l foo*
> | lrwxrwxrwx 1 root root 24 Dec 29 02:41 foobar ->
> | /documents/foobar/
> |
> | [root@CAGE /]# rm foobar/
> | rm: cannot remove directory `foobar/': Is a directory
> |
> | [root@CAGE /]# rm -f foobar/
> | rm: cannot remove `foobar/': Not a directory
> |
> | # Didn't think this would work but tried anyway
> | [root@CAGE /]# rmdir foobar/
> | rmdir: `foobar/': Not a directory
>
>
> Have you tried:
>
> rm foobar
>
> *without* the trailing '/'?
>
> Generally, the trailing slash is a directory marker, and you are trying
> to delete a link, not a directory. It may be confusing the file selection
> code.
>
>
Ya that apppears to be it. I was using the tab key for compleation which
adds the trailing '/'. Thanks for the info.
--
Remove underscores from email address to respond
|
|
|
|
|