How to delete a directory what ends in " ???

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • burro
    New Member
    • Feb 2008
    • 10

    How to delete a directory what ends in " ???

    I have a nuisance directory full of stuff that I want to delete.

    I am an absolute newbie. It is on a network storage device running embedded linux.

    Directory name ends in " (a full/double quote) -- don't ask me how THAT happened...

    when I try to "rm -rf" the thing, I get a > prompt because it is waiting for the close-quote...


    Any tips???
  • burro
    New Member
    • Feb 2008
    • 10

    #2
    The actual directory name is

    iTunes Music b"


    When I run

    rm iTunes*

    it returns

    rm: cannot remove `iTunes Music b': No such file or directory


    (sigh)

    Comment

    • Laharl
      Recognized Expert Contributor
      • Sep 2007
      • 849

      #3
      You can use \" as a control character, or '"', that is, a double inside two single quotes.

      Comment

      • burro
        New Member
        • Feb 2008
        • 10

        #4
        Thanks...

        so I try

        # rm iTunes' 'Music' 'b'"'

        and I get

        rm: cannot remove `iTunes Music b"': No such file or directory

        ???

        Any other tips?

        Many thanks...

        Comment

        • sicarie
          Recognized Expert Specialist
          • Nov 2006
          • 4677

          #5
          I have a few questions - are you in the immediate directory? (When you run the command (without the quotes) "ls" do you see that directory listed?), do you have permissions to delete the folder? (When you are in the directory that directory is contained in and you run (again, without the quotes) "ls -alh" are you the owner or does the directory have permissions for you to be able to modify that directory? and can you tab fill it? (When you type in most of the command and/or directory, the shell is usually (depending on the shell) smart enough to tabfill the rest of it, so you could, theoretically, type in "rm iTun" and hit tab, and have it fill in the rest for you, which would make sure not only that you could see it, but also that you were spelling it correctly.)

          Comment

          • numberwhun
            Recognized Expert Moderator Specialist
            • May 2007
            • 3467

            #6
            There are always little tricks to doing this in Unix, but one nice, easy way I have found, is to use something like winscp or an FTP program to connect to the machine, if you can, browse to the directory and either change the name or delete it. Simple, but not always possible.

            Comment

            • burro
              New Member
              • Feb 2008
              • 10

              #7
              Not sure how to clarify...

              I am telnet-ing into the embedded linux OS of a Maxtor Shared Storage Plus drive (NAS).

              The drive cannot be seen via FTP (even when I install vsftpd), nor can it be mounted from my OS X v 10.4.11 Intel iMac (which should be possible).

              I am using the openmss.org firmware, which has several keen tools like busybox, none of which I know how to use.

              The most I have been able to do is to 777 all the directories and files, EXCEPT one set of files that might be corrupted in the directory I am trying to trash...

              The only ways to "see" this drive are to telnet or to use the web-browser interface.

              Until I 777'd everything, I could not create new users, but now at least I can do that...

              Really -- please keep the tips coming -- I am nearly desperate to get this drive working!

              Many thanks.

              Comment

              • burro
                New Member
                • Feb 2008
                • 10

                #8
                Yes -- hwne I ls I see that directory listed...

                but whenever I use the name, the " is read as an open quote, and I get a prompt looking for the rest of the phrase and a close quote.

                Comment

                • burro
                  New Member
                  • Feb 2008
                  • 10

                  #9
                  Tab complete *does* work... when I do that, I get this:

                  # ls
                  iTunes Music b"
                  # rm iTunes\ Music\ b"/
                  rm: cannot remove `iTunes Music b': No such file or directory
                  #

                  Comment

                  • sicarie
                    Recognized Expert Specialist
                    • Nov 2006
                    • 4677

                    #10
                    Originally posted by burro
                    Tab complete *does* work... when I do that, I get this:

                    # ls
                    iTunes Music b"
                    # rm iTunes\ Music\ b"/
                    rm: cannot remove `iTunes Music b': No such file or directory
                    #
                    Weird. From there, I'd try two things - first I would try escaping the " - it seems that's something that's not caught by the shell, so try:

                    # rm iTunes\ Music\ b\"

                    And then, if you own the box (which as you're able to 777 things, I'm guessing you do), either run that as sudo or root (preferably sudo).

                    Something you might want to check is if the directory is empty -

                    # rm iTunes\ Music\ b"/*

                    (there's a wildcard in there to get all the visible files), and then cd into it and do an

                    # ls -alh

                    just to make sure the only two files in there are "." and "..". If there is something else, (say a .iTunesList) or anything else that begins with a . you will not be able to delete the directory.

                    Comment

                    • WinblowsME
                      New Member
                      • Jan 2008
                      • 58

                      #11
                      How about listing the inode number of the folder (ls -li) and use find . -inum inode_num -exec rm -rf {} \; to delete the folder?

                      Comment

                      • burro
                        New Member
                        • Feb 2008
                        • 10

                        #12
                        # ls -alh
                        drwxrwxrwx 15 0 0 512 Feb 11 13:24 .
                        drwxrwxrwx 1 0 0 0 Dec 31 1999 ..
                        drwxrwxrwx 3 0 0 80 Feb 11 12:05 Public
                        drwxrwxrwx 2 0 0 48 Apr 14 2006 __bksts
                        drwxrwxrwx 3 0 0 72 Apr 14 2006 __bonjour
                        drwxrwxrwx 6 0 0 144 Apr 14 2006 __daap
                        drwxrwxrwx 2 0 0 48 Feb 11 11:51 __deleting
                        drwxrwxrwx 7 0 0 168 Jan 31 17:32 __drivers
                        drwxrwxrwx 5 0 0 120 Apr 2 2006 __mediabolic
                        drwxr-xr-x 7 0 0 168 Jul 23 2005 __opt
                        drwxrwxrwx 2 0 0 232 Nov 21 2005 __pdc
                        -rw-r--r-- 1 0 0 206 Feb 11 13:24 __share_Public_ vars.txt
                        -rw-r--r-- 1 0 0 18 Feb 11 11:52 __share_list.tx t
                        -rwxrwxrwx 1 0 0 1.0M Apr 2 2006 __shrStatus
                        -rwxrwxrwx 1 0 0 6 Apr 2 2006 __shrsem
                        drwxrwxrwx 4 0 0 96 Jan 31 17:32 __var
                        drwxrwxrwx 2 0 0 48 Feb 11 11:52 sharedmain
                        # cd Public
                        # ls -alh
                        drwxrwxrwx 3 0 0 80 Feb 11 12:05 .
                        drwxrwxrwx 15 0 0 512 Feb 11 13:24 ..
                        drwxrwxrwx 23 35000 0 728 Feb 11 12:05 iTunes Music b"
                        #

                        Comment

                        • burro
                          New Member
                          • Feb 2008
                          • 10

                          #13
                          Thanks for that tip about going by nodes -- not sure how to read your suggestion -- could you help me with my specific response to {ls -li}


                          # ls -li
                          61 drwxrwxrwx 23 35000 0 728 Feb 11 12:05 iTunes Music b"
                          #

                          Comment

                          • sicarie
                            Recognized Expert Specialist
                            • Nov 2006
                            • 4677

                            #14
                            Did you try to do an ls -alh inside the iTunes Music b" folder?

                            My guess is there is either a hidden file or an existing file that hasn't been removed.

                            Comment

                            • burro
                              New Member
                              • Feb 2008
                              • 10

                              #15
                              I cannot cd into the iTunes folder... :-(


                              # cd iTunes\ Music\ b"/
                              iTunes Music b: bad directory
                              #

                              Comment

                              Working...