Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-03 Thread Amos Shapira
On 03/01/07, Norman Gaywood <[EMAIL PROTECTED]> wrote: But why are we we trying to pipe output to xargs. We are only dealing with one name. Or zero. I used the "xargs -r" trick to avoid running anything if there is no output from readlink. Whats wrong with just: rm -rf "$(readlink link)

Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Norman Gaywood
On Wed, Jan 03, 2007 at 04:10:45PM +1100, Amos Shapira wrote: > On 03/01/07, Zhasper <[EMAIL PROTECTED]> wrote: > > > >Only because you're using the -0 flag. > > > (This is also going to destroy the ability to handle whitespace in > >filenames though, so you probably don't want to do this.) > >

Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Amos Shapira
On 03/01/07, Zhasper <[EMAIL PROTECTED]> wrote: Only because you're using the -0 flag. ... (This is also going to destroy the ability to handle whitespace in filenames though, so you probably don't want to do this.) Correct on both accounts, but this is why I insist on using -0 whenever

Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Zhasper
On 1/3/07, Amos Shapira <[EMAIL PROTECTED]> wrote: On 03/01/07, Penedo <[EMAIL PROTECTED]> wrote: > readlink -fe link | xargs -0r rm -rf > Correction to the above - apparently xargs waits for "\0" in order to terminate its input, Only because you're using the -0 flag. --null, -0

Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Amos Shapira
On 03/01/07, Penedo <[EMAIL PROTECTED]> wrote: readlink -fe link | xargs -0r rm -rf Correction to the above - apparently xargs waits for "\0" in order to terminate its input, so maybe the following is more appropriate: $ (readlink -fen link ; echo -e \\0) | xargs -0r rm -rf --Amos -- SLUG

Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Norman Gaywood
On Wed, Jan 03, 2007 at 03:20:09PM +1100, Penedo wrote: > Sorry Simon, I was going to pass but then I saw readlink(1), so something > like: > > readlink -fe link | xargs -0r rm -rf > > Should do the trick. Well spotted! I had never noticed readlink before. It will indeed do the trick. Also remo

Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Zhasper
On 1/3/07, Norman Gaywood <[EMAIL PROTECTED]> wrote: I must be missing something simple. $ mkdir dir $ ln -s dir link $ rm link/ rm: cannot remove `link/': Not a directory $ rm -f link/ rm: cannot remove `link/': Not a directory $ rm -rf link/ rm: cannot remove `link/': Not a directory $ rmdir l

Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Robert Collins
On Wed, 2007-01-03 at 14:36 +1100, Norman Gaywood wrote: > I must be missing something simple. > > $ mkdir dir > $ ln -s dir link > $ rm link/ > rm: cannot remove `link/': Not a directory > $ rm -f link/ > rm: cannot remove `link/': Not a directory > $ rm -rf link/ > rm: cannot remove `link/': Not

Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Penedo
On 03/01/07, Simon Males <[EMAIL PROTECTED]> wrote: > On Wed, Jan 03, 2007 at 02:41:51PM +1100, Simon Males wrote: >> Been there. >> >> rm link >> >> No trailing slash. > > No, that removes the link, not the directory pointed to by the link. > > Thanks anyway. Got a bit to excited. rm -ri "`

[SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Norman Gaywood
I must be missing something simple. $ mkdir dir $ ln -s dir link $ rm link/ rm: cannot remove `link/': Not a directory $ rm -f link/ rm: cannot remove `link/': Not a directory $ rm -rf link/ rm: cannot remove `link/': Not a directory $ rmdir link/ rmdir: link/: Not a directory $ rm -rf link/. rm:

Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Simon Males
> On Wed, Jan 03, 2007 at 02:41:51PM +1100, Simon Males wrote: >> Been there. >> >> rm link >> >> No trailing slash. > > No, that removes the link, not the directory pointed to by the link. > > Thanks anyway. Got a bit to excited. rm -ri "`ls -l link | awk -F' ' {'print $11'}`" To dynamify it,

Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Simon Males
Been there. rm link No trailing slash. > I must be missing something simple. > > $ mkdir dir > $ ln -s dir link > $ rm link/ > rm: cannot remove `link/': Not a directory > $ rm -f link/ > rm: cannot remove `link/': Not a directory > $ rm -rf link/ > rm: cannot remove `link/': Not a directory >

Re: [SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Norman Gaywood
On Wed, Jan 03, 2007 at 02:41:51PM +1100, Simon Males wrote: > Been there. > > rm link > > No trailing slash. No, that removes the link, not the directory pointed to by the link. Thanks anyway. > > I must be missing something simple. > > > > $ mkdir dir > > $ ln -s dir link > > $ rm link/ > >

[SLUG] How do I remove a directory pointed to by a symbolic link

2007-01-02 Thread Norman Gaywood
I must be missing something simple. $ mkdir dir $ ln -s dir link $ rm link/ rm: cannot remove `link/': Not a directory $ rm -f link/ rm: cannot remove `link/': Not a directory $ rm -rf link/ rm: cannot remove `link/': Not a directory $ rmdir link/ rmdir: link/: Not a directory $ rm -rf link/. rm: