How to delete a file that contains spaces in the file name?












10















I have a file with this name "Registering wrong app ", there are a few spaces in the file name, now I can't delete it, it won't even let me change file name, I also tried to delete it from my Java program, it won't let me either, how to delete it?



When deleting it from Explorer, I got this:



Could not find this item
This is no longer located in C:My_Dir.
Verify the item's location and try again.

Registering wrong app
Type: File
Siz: 0 bytes


The strange thing is, this file is invisible to the system, it's 0 in size and has space in its name.










share|improve this question

























  • What message do you get when you try to delete it from Explorer?

    – Stephen Jennings
    Feb 13 '11 at 23:40
















10















I have a file with this name "Registering wrong app ", there are a few spaces in the file name, now I can't delete it, it won't even let me change file name, I also tried to delete it from my Java program, it won't let me either, how to delete it?



When deleting it from Explorer, I got this:



Could not find this item
This is no longer located in C:My_Dir.
Verify the item's location and try again.

Registering wrong app
Type: File
Siz: 0 bytes


The strange thing is, this file is invisible to the system, it's 0 in size and has space in its name.










share|improve this question

























  • What message do you get when you try to delete it from Explorer?

    – Stephen Jennings
    Feb 13 '11 at 23:40














10












10








10


4






I have a file with this name "Registering wrong app ", there are a few spaces in the file name, now I can't delete it, it won't even let me change file name, I also tried to delete it from my Java program, it won't let me either, how to delete it?



When deleting it from Explorer, I got this:



Could not find this item
This is no longer located in C:My_Dir.
Verify the item's location and try again.

Registering wrong app
Type: File
Siz: 0 bytes


The strange thing is, this file is invisible to the system, it's 0 in size and has space in its name.










share|improve this question
















I have a file with this name "Registering wrong app ", there are a few spaces in the file name, now I can't delete it, it won't even let me change file name, I also tried to delete it from my Java program, it won't let me either, how to delete it?



When deleting it from Explorer, I got this:



Could not find this item
This is no longer located in C:My_Dir.
Verify the item's location and try again.

Registering wrong app
Type: File
Siz: 0 bytes


The strange thing is, this file is invisible to the system, it's 0 in size and has space in its name.







windows-7






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 10 '17 at 14:25









djsmiley2k

5,02612336




5,02612336










asked Feb 13 '11 at 23:30









FrankFrank

2461313




2461313













  • What message do you get when you try to delete it from Explorer?

    – Stephen Jennings
    Feb 13 '11 at 23:40



















  • What message do you get when you try to delete it from Explorer?

    – Stephen Jennings
    Feb 13 '11 at 23:40

















What message do you get when you try to delete it from Explorer?

– Stephen Jennings
Feb 13 '11 at 23:40





What message do you get when you try to delete it from Explorer?

– Stephen Jennings
Feb 13 '11 at 23:40










6 Answers
6






active

oldest

votes


















11














You can do it like this:



del /F "\?C:My_DirRegistering*wrong*app*"


This will match any amount of characters between and after the words, and also works on wrong files.



If you don't have other files that start with Registering, you might as well try:



del /F "\?C:My_DirRegistering*"




If the file is undeletable, use Process Explorer and search for the handle and kill the owning process.




Find --> Find Handle/DLL (CTRL+F) --> Type in Registering --> Kill the matching processes.







share|improve this answer


























  • instead of Process Explorer,use "unlocker" (ccollomb.free.fr)

    – Alex Angelico
    Feb 14 '11 at 1:22






  • 8





    instead of unlocker, use "Process Explorer" (Microsoft Windows Sysinternals), safe and useful ;-)

    – Tom Wijsman
    Feb 14 '11 at 2:00








  • 1





    Man, this answer takes me back to the DOS 3.1 days. Can always "drop to DOS" (now a command box). Thanks for the effective nostalgia.

    – Mike
    Feb 14 '11 at 4:30



















9














Open a command prompt, and change to the My_Dir directory



cd My_Dir


Get the short (8.3) file name for the file.



dir /a /x /p


You should see something like



02/13/2011  07:25 PM             1,010 REGIST~1     Registering Wrong App


The REGIST~1 is the short file name. Try the del command with that name.



del REGIST~1





share|improve this answer



















  • 3





    This answer (with short names) is wonderful and much simpler than the above solutions with additional programmes! I don't know why it wasn't accepted. Anyway, it worked for me (do delete a folder with the trailing space in name, created by Dropbox probably), thanks man!

    – texnic
    Jun 17 '12 at 15:19






  • 2





    You're welcome. There are many reasons why one answer gets accepted over another. Part of the beauty of Stack Exchange is that even the answers that aren't accepted stay up, so people with similar problems can stumble across them later.

    – Patrick Seymour
    Jun 20 '12 at 0:35



















2














Try putting the filename in quotes, but replacing the spaces with question marks, like this:



del "registering?wrong?app"



That should delete the file if the spaces aren't really spaces, but nulls or some other invisible character.






share|improve this answer































    1














    Spaces shouldn't matter if you are trying to delete the file from Explorer. If you are trying to delete from the command line simply put the file name in quotes like this del "Registering wrong app ".



    If this does not work you have something else holding you up other than spaces in the file name... like a process that is "locking" the file, thus preventing deletion.






    share|improve this answer































      1














      Delete dirs or files with a space in it:



      dir /a /x/ /p

      "files or dirs with space"

      c:DIR1WITHSPACE~1
      c:DIR2WITHSPACE~2

      ren DIRWITHSPACE~1 TEST

      del test

      "Job done...."





      share|improve this answer

































        0














        For those who still could not get this to work (like me). Using the 7zip file explorer to rename the file works. It appears to perform a more low level rename than windows allows.






        share|improve this answer























          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f245441%2fhow-to-delete-a-file-that-contains-spaces-in-the-file-name%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          6 Answers
          6






          active

          oldest

          votes








          6 Answers
          6






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          11














          You can do it like this:



          del /F "\?C:My_DirRegistering*wrong*app*"


          This will match any amount of characters between and after the words, and also works on wrong files.



          If you don't have other files that start with Registering, you might as well try:



          del /F "\?C:My_DirRegistering*"




          If the file is undeletable, use Process Explorer and search for the handle and kill the owning process.




          Find --> Find Handle/DLL (CTRL+F) --> Type in Registering --> Kill the matching processes.







          share|improve this answer


























          • instead of Process Explorer,use "unlocker" (ccollomb.free.fr)

            – Alex Angelico
            Feb 14 '11 at 1:22






          • 8





            instead of unlocker, use "Process Explorer" (Microsoft Windows Sysinternals), safe and useful ;-)

            – Tom Wijsman
            Feb 14 '11 at 2:00








          • 1





            Man, this answer takes me back to the DOS 3.1 days. Can always "drop to DOS" (now a command box). Thanks for the effective nostalgia.

            – Mike
            Feb 14 '11 at 4:30
















          11














          You can do it like this:



          del /F "\?C:My_DirRegistering*wrong*app*"


          This will match any amount of characters between and after the words, and also works on wrong files.



          If you don't have other files that start with Registering, you might as well try:



          del /F "\?C:My_DirRegistering*"




          If the file is undeletable, use Process Explorer and search for the handle and kill the owning process.




          Find --> Find Handle/DLL (CTRL+F) --> Type in Registering --> Kill the matching processes.







          share|improve this answer


























          • instead of Process Explorer,use "unlocker" (ccollomb.free.fr)

            – Alex Angelico
            Feb 14 '11 at 1:22






          • 8





            instead of unlocker, use "Process Explorer" (Microsoft Windows Sysinternals), safe and useful ;-)

            – Tom Wijsman
            Feb 14 '11 at 2:00








          • 1





            Man, this answer takes me back to the DOS 3.1 days. Can always "drop to DOS" (now a command box). Thanks for the effective nostalgia.

            – Mike
            Feb 14 '11 at 4:30














          11












          11








          11







          You can do it like this:



          del /F "\?C:My_DirRegistering*wrong*app*"


          This will match any amount of characters between and after the words, and also works on wrong files.



          If you don't have other files that start with Registering, you might as well try:



          del /F "\?C:My_DirRegistering*"




          If the file is undeletable, use Process Explorer and search for the handle and kill the owning process.




          Find --> Find Handle/DLL (CTRL+F) --> Type in Registering --> Kill the matching processes.







          share|improve this answer















          You can do it like this:



          del /F "\?C:My_DirRegistering*wrong*app*"


          This will match any amount of characters between and after the words, and also works on wrong files.



          If you don't have other files that start with Registering, you might as well try:



          del /F "\?C:My_DirRegistering*"




          If the file is undeletable, use Process Explorer and search for the handle and kill the owning process.




          Find --> Find Handle/DLL (CTRL+F) --> Type in Registering --> Kill the matching processes.








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 14 '11 at 2:06

























          answered Feb 14 '11 at 0:44









          Tom WijsmanTom Wijsman

          50.3k23164247




          50.3k23164247













          • instead of Process Explorer,use "unlocker" (ccollomb.free.fr)

            – Alex Angelico
            Feb 14 '11 at 1:22






          • 8





            instead of unlocker, use "Process Explorer" (Microsoft Windows Sysinternals), safe and useful ;-)

            – Tom Wijsman
            Feb 14 '11 at 2:00








          • 1





            Man, this answer takes me back to the DOS 3.1 days. Can always "drop to DOS" (now a command box). Thanks for the effective nostalgia.

            – Mike
            Feb 14 '11 at 4:30



















          • instead of Process Explorer,use "unlocker" (ccollomb.free.fr)

            – Alex Angelico
            Feb 14 '11 at 1:22






          • 8





            instead of unlocker, use "Process Explorer" (Microsoft Windows Sysinternals), safe and useful ;-)

            – Tom Wijsman
            Feb 14 '11 at 2:00








          • 1





            Man, this answer takes me back to the DOS 3.1 days. Can always "drop to DOS" (now a command box). Thanks for the effective nostalgia.

            – Mike
            Feb 14 '11 at 4:30

















          instead of Process Explorer,use "unlocker" (ccollomb.free.fr)

          – Alex Angelico
          Feb 14 '11 at 1:22





          instead of Process Explorer,use "unlocker" (ccollomb.free.fr)

          – Alex Angelico
          Feb 14 '11 at 1:22




          8




          8





          instead of unlocker, use "Process Explorer" (Microsoft Windows Sysinternals), safe and useful ;-)

          – Tom Wijsman
          Feb 14 '11 at 2:00







          instead of unlocker, use "Process Explorer" (Microsoft Windows Sysinternals), safe and useful ;-)

          – Tom Wijsman
          Feb 14 '11 at 2:00






          1




          1





          Man, this answer takes me back to the DOS 3.1 days. Can always "drop to DOS" (now a command box). Thanks for the effective nostalgia.

          – Mike
          Feb 14 '11 at 4:30





          Man, this answer takes me back to the DOS 3.1 days. Can always "drop to DOS" (now a command box). Thanks for the effective nostalgia.

          – Mike
          Feb 14 '11 at 4:30













          9














          Open a command prompt, and change to the My_Dir directory



          cd My_Dir


          Get the short (8.3) file name for the file.



          dir /a /x /p


          You should see something like



          02/13/2011  07:25 PM             1,010 REGIST~1     Registering Wrong App


          The REGIST~1 is the short file name. Try the del command with that name.



          del REGIST~1





          share|improve this answer



















          • 3





            This answer (with short names) is wonderful and much simpler than the above solutions with additional programmes! I don't know why it wasn't accepted. Anyway, it worked for me (do delete a folder with the trailing space in name, created by Dropbox probably), thanks man!

            – texnic
            Jun 17 '12 at 15:19






          • 2





            You're welcome. There are many reasons why one answer gets accepted over another. Part of the beauty of Stack Exchange is that even the answers that aren't accepted stay up, so people with similar problems can stumble across them later.

            – Patrick Seymour
            Jun 20 '12 at 0:35
















          9














          Open a command prompt, and change to the My_Dir directory



          cd My_Dir


          Get the short (8.3) file name for the file.



          dir /a /x /p


          You should see something like



          02/13/2011  07:25 PM             1,010 REGIST~1     Registering Wrong App


          The REGIST~1 is the short file name. Try the del command with that name.



          del REGIST~1





          share|improve this answer



















          • 3





            This answer (with short names) is wonderful and much simpler than the above solutions with additional programmes! I don't know why it wasn't accepted. Anyway, it worked for me (do delete a folder with the trailing space in name, created by Dropbox probably), thanks man!

            – texnic
            Jun 17 '12 at 15:19






          • 2





            You're welcome. There are many reasons why one answer gets accepted over another. Part of the beauty of Stack Exchange is that even the answers that aren't accepted stay up, so people with similar problems can stumble across them later.

            – Patrick Seymour
            Jun 20 '12 at 0:35














          9












          9








          9







          Open a command prompt, and change to the My_Dir directory



          cd My_Dir


          Get the short (8.3) file name for the file.



          dir /a /x /p


          You should see something like



          02/13/2011  07:25 PM             1,010 REGIST~1     Registering Wrong App


          The REGIST~1 is the short file name. Try the del command with that name.



          del REGIST~1





          share|improve this answer













          Open a command prompt, and change to the My_Dir directory



          cd My_Dir


          Get the short (8.3) file name for the file.



          dir /a /x /p


          You should see something like



          02/13/2011  07:25 PM             1,010 REGIST~1     Registering Wrong App


          The REGIST~1 is the short file name. Try the del command with that name.



          del REGIST~1






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 14 '11 at 0:35









          Patrick SeymourPatrick Seymour

          7,3522131




          7,3522131








          • 3





            This answer (with short names) is wonderful and much simpler than the above solutions with additional programmes! I don't know why it wasn't accepted. Anyway, it worked for me (do delete a folder with the trailing space in name, created by Dropbox probably), thanks man!

            – texnic
            Jun 17 '12 at 15:19






          • 2





            You're welcome. There are many reasons why one answer gets accepted over another. Part of the beauty of Stack Exchange is that even the answers that aren't accepted stay up, so people with similar problems can stumble across them later.

            – Patrick Seymour
            Jun 20 '12 at 0:35














          • 3





            This answer (with short names) is wonderful and much simpler than the above solutions with additional programmes! I don't know why it wasn't accepted. Anyway, it worked for me (do delete a folder with the trailing space in name, created by Dropbox probably), thanks man!

            – texnic
            Jun 17 '12 at 15:19






          • 2





            You're welcome. There are many reasons why one answer gets accepted over another. Part of the beauty of Stack Exchange is that even the answers that aren't accepted stay up, so people with similar problems can stumble across them later.

            – Patrick Seymour
            Jun 20 '12 at 0:35








          3




          3





          This answer (with short names) is wonderful and much simpler than the above solutions with additional programmes! I don't know why it wasn't accepted. Anyway, it worked for me (do delete a folder with the trailing space in name, created by Dropbox probably), thanks man!

          – texnic
          Jun 17 '12 at 15:19





          This answer (with short names) is wonderful and much simpler than the above solutions with additional programmes! I don't know why it wasn't accepted. Anyway, it worked for me (do delete a folder with the trailing space in name, created by Dropbox probably), thanks man!

          – texnic
          Jun 17 '12 at 15:19




          2




          2





          You're welcome. There are many reasons why one answer gets accepted over another. Part of the beauty of Stack Exchange is that even the answers that aren't accepted stay up, so people with similar problems can stumble across them later.

          – Patrick Seymour
          Jun 20 '12 at 0:35





          You're welcome. There are many reasons why one answer gets accepted over another. Part of the beauty of Stack Exchange is that even the answers that aren't accepted stay up, so people with similar problems can stumble across them later.

          – Patrick Seymour
          Jun 20 '12 at 0:35











          2














          Try putting the filename in quotes, but replacing the spaces with question marks, like this:



          del "registering?wrong?app"



          That should delete the file if the spaces aren't really spaces, but nulls or some other invisible character.






          share|improve this answer




























            2














            Try putting the filename in quotes, but replacing the spaces with question marks, like this:



            del "registering?wrong?app"



            That should delete the file if the spaces aren't really spaces, but nulls or some other invisible character.






            share|improve this answer


























              2












              2








              2







              Try putting the filename in quotes, but replacing the spaces with question marks, like this:



              del "registering?wrong?app"



              That should delete the file if the spaces aren't really spaces, but nulls or some other invisible character.






              share|improve this answer













              Try putting the filename in quotes, but replacing the spaces with question marks, like this:



              del "registering?wrong?app"



              That should delete the file if the spaces aren't really spaces, but nulls or some other invisible character.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Feb 14 '11 at 0:34









              RogerRoger

              1,17731129




              1,17731129























                  1














                  Spaces shouldn't matter if you are trying to delete the file from Explorer. If you are trying to delete from the command line simply put the file name in quotes like this del "Registering wrong app ".



                  If this does not work you have something else holding you up other than spaces in the file name... like a process that is "locking" the file, thus preventing deletion.






                  share|improve this answer




























                    1














                    Spaces shouldn't matter if you are trying to delete the file from Explorer. If you are trying to delete from the command line simply put the file name in quotes like this del "Registering wrong app ".



                    If this does not work you have something else holding you up other than spaces in the file name... like a process that is "locking" the file, thus preventing deletion.






                    share|improve this answer


























                      1












                      1








                      1







                      Spaces shouldn't matter if you are trying to delete the file from Explorer. If you are trying to delete from the command line simply put the file name in quotes like this del "Registering wrong app ".



                      If this does not work you have something else holding you up other than spaces in the file name... like a process that is "locking" the file, thus preventing deletion.






                      share|improve this answer













                      Spaces shouldn't matter if you are trying to delete the file from Explorer. If you are trying to delete from the command line simply put the file name in quotes like this del "Registering wrong app ".



                      If this does not work you have something else holding you up other than spaces in the file name... like a process that is "locking" the file, thus preventing deletion.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Feb 13 '11 at 23:38









                      ubiquibaconubiquibacon

                      6,68722033




                      6,68722033























                          1














                          Delete dirs or files with a space in it:



                          dir /a /x/ /p

                          "files or dirs with space"

                          c:DIR1WITHSPACE~1
                          c:DIR2WITHSPACE~2

                          ren DIRWITHSPACE~1 TEST

                          del test

                          "Job done...."





                          share|improve this answer






























                            1














                            Delete dirs or files with a space in it:



                            dir /a /x/ /p

                            "files or dirs with space"

                            c:DIR1WITHSPACE~1
                            c:DIR2WITHSPACE~2

                            ren DIRWITHSPACE~1 TEST

                            del test

                            "Job done...."





                            share|improve this answer




























                              1












                              1








                              1







                              Delete dirs or files with a space in it:



                              dir /a /x/ /p

                              "files or dirs with space"

                              c:DIR1WITHSPACE~1
                              c:DIR2WITHSPACE~2

                              ren DIRWITHSPACE~1 TEST

                              del test

                              "Job done...."





                              share|improve this answer















                              Delete dirs or files with a space in it:



                              dir /a /x/ /p

                              "files or dirs with space"

                              c:DIR1WITHSPACE~1
                              c:DIR2WITHSPACE~2

                              ren DIRWITHSPACE~1 TEST

                              del test

                              "Job done...."






                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Nov 19 '11 at 14:46









                              slhck

                              161k47447470




                              161k47447470










                              answered Nov 19 '11 at 14:30









                              BartBart

                              111




                              111























                                  0














                                  For those who still could not get this to work (like me). Using the 7zip file explorer to rename the file works. It appears to perform a more low level rename than windows allows.






                                  share|improve this answer




























                                    0














                                    For those who still could not get this to work (like me). Using the 7zip file explorer to rename the file works. It appears to perform a more low level rename than windows allows.






                                    share|improve this answer


























                                      0












                                      0








                                      0







                                      For those who still could not get this to work (like me). Using the 7zip file explorer to rename the file works. It appears to perform a more low level rename than windows allows.






                                      share|improve this answer













                                      For those who still could not get this to work (like me). Using the 7zip file explorer to rename the file works. It appears to perform a more low level rename than windows allows.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jan 26 at 8:03









                                      jamesakadamingojamesakadamingo

                                      1012




                                      1012






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Super User!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f245441%2fhow-to-delete-a-file-that-contains-spaces-in-the-file-name%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Probability when a professor distributes a quiz and homework assignment to a class of n students.

                                          Aardman Animations

                                          Are they similar matrix