Loading ...
Sorry, an error occurred while loading the content.
 

How to remove a directory?

Expand Messages
  • figovh
    I m a Linux novice, and am trying to clean up after installing Slimserver on my Linkstation II. Having had several failed attempts, I now have several
    Message 1 of 8 , Sep 25, 2006
      I'm a Linux novice, and am trying to clean up after installing
      Slimserver on my Linkstation II. Having had several failed attempts, I
      now have several directories/folders with names such as
      "bad-slimserver", "old-CPAN", etc which I want to delete.

      If I try rmdir (it's the busybox version which came with OpenLink), it
      tells me I can only use rmdir when the directory has no files in it.
      If I use Windows Explorer and link to the Linkstation as a network
      drive, I can't delete the directory because there are some folders or
      files which are protected.

      Is there an easy way to remove a whole directory which has protected
      files?

      Any help would be much appreciated.

      Harry.
    • lalunas10
      ... [...] ... Harry, rmdir indeed only removes emtpy directories. rm -r (remove recursively) does what you want, but use this with extreme caution: rm -r
      Message 2 of 8 , Sep 25, 2006
        --- In LinkStation_General@yahoogroups.com, "figovh" <harryfigov@...> wrote:
        [...]
        > If I try rmdir (it's the busybox version which came with OpenLink), it
        > tells me I can only use rmdir when the directory has no files in it.

        Harry,

        "rmdir" indeed only removes emtpy directories. "rm -r" (remove recursively) does what you
        want, but use this with extreme caution: "rm -r /" has the same effect as formating you hard
        drive, wildcards like "*" are dangerous too. It's a good idea to use tab-completion; say, you
        want to remove /mnt/oldslim/ and its contents. You would enter /mnt/olds<tab>, and the
        shell would expand it to the real directory name.

        -Andre
      • figovh
        Hi Andre, Thanks for the advice. Unfortunately it doesn t work for me. It seems as if the Busybox version of rmdir doesn t have the -r option. It also
        Message 3 of 8 , Sep 25, 2006
          Hi Andre,

          Thanks for the advice. Unfortunately it doesn't work for me. It seems
          as if the Busybox version of rmdir doesn't have the "-r" option. It
          also doesn't seem to handle tab-completion.

          Here's the output from my attempt:-

          *****

          root@LINKS1:/mnt/hda/share# rmdir -r bad-slimser<tab>
          bash: syntax error near unexpected token `bad-slimser<tab>'
          root@LINKS1:/mnt/hda/share# rmdir -r /mnt/hda/share/bad<tab>
          bash: syntax error near unexpected token `/mnt/hda/share/bad<tab>'
          root@LINKS1:/mnt/hda/share# rmdir -r slimserver
          rmdir: invalid option -- r
          BusyBox v1.00 (2005.08.06-22:16+0000) multi-call binary

          Usage: rmdir [OPTION]... DIRECTORY...

          Remove the DIRECTORY(ies), if they are empty.
          ******

          Harry.
          > Harry,
          >
          > "rmdir" indeed only removes emtpy directories. "rm -r" (remove
          recursively) does what you
          > want, but use this with extreme caution: "rm -r /" has the same
          effect as formating you hard
          > drive, wildcards like "*" are dangerous too. It's a good idea to use
          tab-completion; say, you
          > want to remove /mnt/oldslim/ and its contents. You would enter
          /mnt/olds<tab>, and the
          > shell would expand it to the real directory name.
          >
          > -Andre
          >
        • timo
          ... Not rmdir -r , but: rm -r T.
          Message 4 of 8 , Sep 25, 2006
            On Sep 25 at 19:18, figovh wrote:

            > Thanks for the advice. Unfortunately it doesn't work for me. It seems
            > as if the Busybox version of rmdir doesn't have the "-r" option. It
            > also doesn't seem to handle tab-completion.

            Not rmdir -r , but: rm -r

            T.
          • KeepIt SimpleStupid
            Usual method on unix systems is: cd rm * cd .. rmdir ... __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo!
            Message 5 of 8 , Sep 25, 2006
              Usual method on unix systems is:

              cd <dir>
              rm *
              cd ..
              rmdir <dir>

              --- figovh <harryfigov@...> wrote:

              > I'm a Linux novice, and am trying to clean up after
              > installing
              > Slimserver on my Linkstation II. Having had several
              > failed attempts, I
              > now have several directories/folders with names such
              > as
              > "bad-slimserver", "old-CPAN", etc which I want to
              > delete.
              >
              > If I try rmdir (it's the busybox version which came
              > with OpenLink), it
              > tells me I can only use rmdir when the directory has
              > no files in it.
              > If I use Windows Explorer and link to the
              > Linkstation as a network
              > drive, I can't delete the directory because there
              > are some folders or
              > files which are protected.
              >
              > Is there an easy way to remove a whole directory
              > which has protected
              > files?
              >
              > Any help would be much appreciated.
              >
              > Harry.
              >
              >
              >
              >
              >


              __________________________________________________
              Do You Yahoo!?
              Tired of spam? Yahoo! Mail has the best spam protection around
              http://mail.yahoo.com
            • figovh
              Doh! - I should should RTFM! Thanks for pointing it out. I ll give it a go. Harry.
              Message 6 of 8 , Sep 26, 2006
                Doh! - I should should RTFM!

                Thanks for pointing it out. I'll give it a go.
                Harry.
                --- In LinkStation_General@yahoogroups.com, timo <timoh@...> wrote:
                >
                > On Sep 25 at 19:18, figovh wrote:
                >
                > > Thanks for the advice. Unfortunately it doesn't work for me. It seems
                > > as if the Busybox version of rmdir doesn't have the "-r" option. It
                > > also doesn't seem to handle tab-completion.
                >
                > Not rmdir -r , but: rm -r
                >
                > T.
                >
              • figovh
                Hi - I did look at doing it that way, but because of the depth and complexity of the structure of these directories, it would take forever to do it this way.
                Message 7 of 8 , Sep 26, 2006
                  Hi - I did look at doing it that way, but because of the depth and
                  complexity of the structure of these directories, it would take
                  forever to do it this way.

                  Harry.
                  --- In LinkStation_General@yahoogroups.com, KeepIt SimpleStupid
                  <keepitsimplestupid@...> wrote:
                  >
                  > Usual method on unix systems is:
                  >
                  > cd <dir>
                  > rm *
                  > cd ..
                  > rmdir <dir>
                  >
                  > --- figovh <harryfigov@...> wrote:
                  >
                  > > I'm a Linux novice, and am trying to clean up after
                  > > installing
                  > > Slimserver on my Linkstation II. Having had several
                  > > failed attempts, I
                  > > now have several directories/folders with names such
                  > > as
                  > > "bad-slimserver", "old-CPAN", etc which I want to
                  > > delete.
                  > >
                  > > If I try rmdir (it's the busybox version which came
                  > > with OpenLink), it
                  > > tells me I can only use rmdir when the directory has
                  > > no files in it.
                  > > If I use Windows Explorer and link to the
                  > > Linkstation as a network
                  > > drive, I can't delete the directory because there
                  > > are some folders or
                  > > files which are protected.
                  > >
                  > > Is there an easy way to remove a whole directory
                  > > which has protected
                  > > files?
                  > >
                  > > Any help would be much appreciated.
                  > >
                  > > Harry.
                  > >
                  > >
                  > >
                  > >
                  > >
                  >
                  >
                  > __________________________________________________
                  > Do You Yahoo!?
                  > Tired of spam? Yahoo! Mail has the best spam protection around
                  > http://mail.yahoo.com
                  >
                • figovh
                  Thanks Andre and T - that worked a treat and the TAB expansion worked too once I figured out that meant to press the tab key. Much appreciated. Harry.
                  Message 8 of 8 , Sep 26, 2006
                    Thanks Andre and T - that worked a treat and the TAB expansion worked
                    too once I figured out that <TAB> meant to press the tab key.

                    Much appreciated.
                    Harry.
                    --- In LinkStation_General@yahoogroups.com, timo <timoh@...> wrote:
                    >
                    > On Sep 25 at 19:18, figovh wrote:
                    >
                    > > Thanks for the advice. Unfortunately it doesn't work for me. It seems
                    > > as if the Busybox version of rmdir doesn't have the "-r" option. It
                    > > also doesn't seem to handle tab-completion.
                    >
                    > Not rmdir -r , but: rm -r
                    >
                    > T.
                    >
                  Your message has been successfully submitted and would be delivered to recipients shortly.