Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Help me to delete a Directory

Help me to delete a Directory

Scheduled Pinned Locked Moved The Lounge
helpcomquestion
26 Posts 13 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Neville Franks

    Ok I've accidently created a directory on WinXP which has a SPACE as the last character and I can't delete it from Explorer, DOS or in code. I also can't rename it from Explorer. I figured ChkDsk would fix it up but it doesn't find any problems. What to do? And why the heck did Windows let me create it in the first place.:confused: Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

    B Offline
    B Offline
    benjymous
    wrote on last edited by
    #3

    I can remember doing something similar in the DOS days - Turbo Pascal would happily let you create files with spaces in the filename, but whilst DOS could see the files, there was no way it'd let you manipulate them. The only way to get rid of it was using Turbo Pascal itself to delete the file. Maybe that's your answer.. ..or maybe if you delve to a lower level of code you'll find a function that will let you delete it directly. What happens if you try and delete the parent folder? -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

    N 1 Reply Last reply
    0
    • R Rocky Moore

      Just curious if you can drag it into another temporary folder and delete the temp with it in it.. Have you tried in DOS using a shifted space? Rocky <>< Mozilla/Firefox Crushing IE's Lead![^]

      N Offline
      N Offline
      Neville Franks
      wrote on last edited by
      #4

      Rocky Moore wrote: Just curious if you can drag it into another temporary folder and delete the temp with it in it.. Drop fails, as does Cut/Paste. I can't delete the parent directory, which I would happilly do. Rocky Moore wrote: Have you tried in DOS using a shifted space? No. What is a: "shifted space"? Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

      1 Reply Last reply
      0
      • B benjymous

        I can remember doing something similar in the DOS days - Turbo Pascal would happily let you create files with spaces in the filename, but whilst DOS could see the files, there was no way it'd let you manipulate them. The only way to get rid of it was using Turbo Pascal itself to delete the file. Maybe that's your answer.. ..or maybe if you delve to a lower level of code you'll find a function that will let you delete it directly. What happens if you try and delete the parent folder? -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

        N Offline
        N Offline
        Neville Franks
        wrote on last edited by
        #5

        I tried using C's rmdir() and that failed. I haven't tried deleting the parent directory from C++ code, but I doubt whether you can without deleting the sub-directories first. Deleting the parent from Windows Explorer fails. It was created by C++ code.:^) Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

        1 Reply Last reply
        0
        • N Neville Franks

          Ok I've accidently created a directory on WinXP which has a SPACE as the last character and I can't delete it from Explorer, DOS or in code. I also can't rename it from Explorer. I figured ChkDsk would fix it up but it doesn't find any problems. What to do? And why the heck did Windows let me create it in the first place.:confused: Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

          N Offline
          N Offline
          Nish Nishant
          wrote on last edited by
          #6

          Hey Neville Are you sure it's a space and not ASCII 255? Nish

          N 1 Reply Last reply
          0
          • N Neville Franks

            Ok I've accidently created a directory on WinXP which has a SPACE as the last character and I can't delete it from Explorer, DOS or in code. I also can't rename it from Explorer. I figured ChkDsk would fix it up but it doesn't find any problems. What to do? And why the heck did Windows let me create it in the first place.:confused: Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

            P Offline
            P Offline
            PJ Arends
            wrote on last edited by
            #7

            In DOS have you tried enclosing the folder name in quotes?

            rd "Folder "


            "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!


            Honoured as one of The Most Helpful Members of 2004

            N 1 Reply Last reply
            0
            • N Neville Franks

              Ok I've accidently created a directory on WinXP which has a SPACE as the last character and I can't delete it from Explorer, DOS or in code. I also can't rename it from Explorer. I figured ChkDsk would fix it up but it doesn't find any problems. What to do? And why the heck did Windows let me create it in the first place.:confused: Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

              O Offline
              O Offline
              One Stone
              wrote on last edited by
              #8

              I don't think the last character is a space... I've tried this (created directory with space at the end) and successfully deleted it in the Explorer...

              B 1 Reply Last reply
              0
              • P PJ Arends

                In DOS have you tried enclosing the folder name in quotes?

                rd "Folder "


                "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!


                Honoured as one of The Most Helpful Members of 2004

                N Offline
                N Offline
                Neville Franks
                wrote on last edited by
                #9

                PJ Arends wrote: In DOS have you tried enclosing the folder name in quotes? rd "Folder " Yep. The folder is named: "http " so I wonder whether "http" is playing a part in my woes. Can't rename it either. Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                P 1 Reply Last reply
                0
                • N Nish Nishant

                  Hey Neville Are you sure it's a space and not ASCII 255? Nish

                  N Offline
                  N Offline
                  Neville Franks
                  wrote on last edited by
                  #10

                  Nishant S wrote: Hey Neville Are you sure it's a space and not ASCII 255? I'm 99% sure it is a space. See my reply to PJ re. "http" Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                  1 Reply Last reply
                  0
                  • N Neville Franks

                    PJ Arends wrote: In DOS have you tried enclosing the folder name in quotes? rd "Folder " Yep. The folder is named: "http " so I wonder whether "http" is playing a part in my woes. Can't rename it either. Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                    P Offline
                    P Offline
                    PJ Arends
                    wrote on last edited by
                    #11

                    You said previously you could not delete the parent folder. Have you tried with the /s parameter?

                    rd Parent /s


                    "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!


                    Honoured as one of The Most Helpful Members of 2004

                    N 1 Reply Last reply
                    0
                    • P PJ Arends

                      You said previously you could not delete the parent folder. Have you tried with the /s parameter?

                      rd Parent /s


                      "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!


                      Honoured as one of The Most Helpful Members of 2004

                      N Offline
                      N Offline
                      Neville Franks
                      wrote on last edited by
                      #12

                      PJ Arends wrote: You said previously you could not delete the parent folder. Have you tried with the /s parameter? rd Parent /s Hadn't tried that, but I do have success. I did a dir /x and got the short name which was: HTTP~1 and the I was able to delete that.:sigh: So now you all know never ever create a directory named: "http ". Thanks for everyones help. Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                      A 1 Reply Last reply
                      0
                      • N Neville Franks

                        Ok I've accidently created a directory on WinXP which has a SPACE as the last character and I can't delete it from Explorer, DOS or in code. I also can't rename it from Explorer. I figured ChkDsk would fix it up but it doesn't find any problems. What to do? And why the heck did Windows let me create it in the first place.:confused: Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                        A Offline
                        A Offline
                        Aamir Butt
                        wrote on last edited by
                        #13

                        have u tried renaming it in dos by rename command. Found on Bash.org I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet My Articles

                        1 Reply Last reply
                        0
                        • O One Stone

                          I don't think the last character is a space... I've tried this (created directory with space at the end) and successfully deleted it in the Explorer...

                          B Offline
                          B Offline
                          benjymous
                          wrote on last edited by
                          #14

                          but explorer is crafty, and decides you didn't really want that space at the end of the filename, so removes it for you (try it again, and look at the properties of the directory after you create it) -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

                          1 Reply Last reply
                          0
                          • N Neville Franks

                            Ok I've accidently created a directory on WinXP which has a SPACE as the last character and I can't delete it from Explorer, DOS or in code. I also can't rename it from Explorer. I figured ChkDsk would fix it up but it doesn't find any problems. What to do? And why the heck did Windows let me create it in the first place.:confused: Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                            D Offline
                            D Offline
                            Daniel Turini
                            wrote on last edited by
                            #15

                            on a DOS prompt, try (suppose the folder name is "Folder ":

                            ren Fol* SomeNiceName

                            And then delete SomeNiceName. Yes, even I am blogging now!

                            N 1 Reply Last reply
                            0
                            • N Neville Franks

                              PJ Arends wrote: You said previously you could not delete the parent folder. Have you tried with the /s parameter? rd Parent /s Hadn't tried that, but I do have success. I did a dir /x and got the short name which was: HTTP~1 and the I was able to delete that.:sigh: So now you all know never ever create a directory named: "http ". Thanks for everyones help. Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                              A Offline
                              A Offline
                              Antony M Kancidrowski
                              wrote on last edited by
                              #16

                              Neville Franks wrote: I did a dir /x and got the short name which was: HTTP~1 and the I was able to delete that Good old 8.3 format, nice to know it really hasn't died! ;) Ant. I'm hard, yet soft.
                              I'm coloured, yet clear.
                              I'm fruity and sweet.
                              I'm jelly, what am I? Muse on it further, I shall return!
                              - David Walliams (Little Britain)

                              1 Reply Last reply
                              0
                              • D Daniel Turini

                                on a DOS prompt, try (suppose the folder name is "Folder ":

                                ren Fol* SomeNiceName

                                And then delete SomeNiceName. Yes, even I am blogging now!

                                N Offline
                                N Offline
                                Neville Franks
                                wrote on last edited by
                                #17

                                I had already tried that, didn't work either. See my reply to PJ's thread. Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                                1 Reply Last reply
                                0
                                • N Neville Franks

                                  Ok I've accidently created a directory on WinXP which has a SPACE as the last character and I can't delete it from Explorer, DOS or in code. I also can't rename it from Explorer. I figured ChkDsk would fix it up but it doesn't find any problems. What to do? And why the heck did Windows let me create it in the first place.:confused: Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                                  B Offline
                                  B Offline
                                  Bassam Abdul Baki
                                  wrote on last edited by
                                  #18

                                  Back in the days of Kazaa, I decided one day to uninstall it. It accidentally left a folder in there (can't remember the name) that I couldn't delete. I tried just about every way that I can think of, and even up to today (2 years later - and no I don't usually format such problems away :)), that darn folder still exists. What's funny is that I can't even open the folder in Windows Explorer or use a DOS window to peek into its contents. As far as I can see, it has no special attributes, but it won't allow me to manipulate even those in Windows and in DOS. Here's an idea for a necessary tool for someone to create. Read the content of a file or folder, determine where in assembly that file/folder is. Go down to the byte-code of that file/folder and zero it (fragment it) out completely. "For that one fraction of a second, you were open to options you would never have considered. That is the exploration that awaits you. Not mapping stars and studying nebula, but charting the unknown possibilities of existence." - Q (Star Trek: The Next Generation) ^ Blog

                                  B 1 Reply Last reply
                                  0
                                  • N Neville Franks

                                    Ok I've accidently created a directory on WinXP which has a SPACE as the last character and I can't delete it from Explorer, DOS or in code. I also can't rename it from Explorer. I figured ChkDsk would fix it up but it doesn't find any problems. What to do? And why the heck did Windows let me create it in the first place.:confused: Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                                    O Offline
                                    O Offline
                                    Obliterator
                                    wrote on last edited by
                                    #19

                                    Yeah its a really annoying problem I've encountered before. One of my FTP clients downloaded a file from a unix machine, the name of which ended in a space. Spaces are legal in the filesystem, but illegal in windows. It seems the APIs allow such creation, but windows and is then unable to deal with them. KB Q101754: Unable to Delete File or Directory in File Manager[^] KB Q120716: How to Remove Files with Reserved Names in Windows[^] -- The Obliterator

                                    N 1 Reply Last reply
                                    0
                                    • N Neville Franks

                                      Ok I've accidently created a directory on WinXP which has a SPACE as the last character and I can't delete it from Explorer, DOS or in code. I also can't rename it from Explorer. I figured ChkDsk would fix it up but it doesn't find any problems. What to do? And why the heck did Windows let me create it in the first place.:confused: Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                                      K Offline
                                      K Offline
                                      KaRl
                                      wrote on last edited by
                                      #20

                                      Find the DOS short name for your folder (the one with a "~") and try to delete using this short name, 8+3. You could use Windows API GetShortPathName to find it, but I'm sure there'a an easy way through the command line. I just don't remember which one :~


                                      Fold With Us! Sie wollen mein Herz am rechten Fleck, doch Seh' ich dann nach unten weg Da schlägt es links

                                      M 1 Reply Last reply
                                      0
                                      • N Neville Franks

                                        Ok I've accidently created a directory on WinXP which has a SPACE as the last character and I can't delete it from Explorer, DOS or in code. I also can't rename it from Explorer. I figured ChkDsk would fix it up but it doesn't find any problems. What to do? And why the heck did Windows let me create it in the first place.:confused: Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

                                        M Offline
                                        M Offline
                                        Michael Dunn
                                        wrote on last edited by
                                        #21

                                        I'm too lazy to read thru the thread ;) to see if anyone's suggested this yet, but you can prepend \\?\ to any path to turn off special character parsing, so this might work: del "\\?\C:\path\to\dir " If that doesn't work on the command line, I 99% guarantee it would work in C code. --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb Strange things are afoot at the U+004B U+20DD

                                        1 Reply Last reply
                                        0
                                        • K KaRl

                                          Find the DOS short name for your folder (the one with a "~") and try to delete using this short name, 8+3. You could use Windows API GetShortPathName to find it, but I'm sure there'a an easy way through the command line. I just don't remember which one :~


                                          Fold With Us! Sie wollen mein Herz am rechten Fleck, doch Seh' ich dann nach unten weg Da schlägt es links

                                          M Offline
                                          M Offline
                                          Michael Dunn
                                          wrote on last edited by
                                          #22

                                          dir /x shows you the 8.3 aliases. --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb Strange things are afoot at the U+004B U+20DD

                                          K N 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups