3

This is a very similar problem to this QA ( How can I delete a file that "Does not exist" ), except I'm on an entirely Windows computer, whereas the OP in that question was SSHing to a NAS running Linux.

I was using git with GitKraken and was performing a merge that I later aborted. During the merge I was diffing two files from two commits in the same branch and git (or GitKraken - I'm not sure who was responsible for the file, exactly) created two files on-disk representing a merge-conflicted file, each file represents the file's state from each commit.

When I was done, I tried to delete the files (it failed to clean-up after itself) - one of the two files was deleted successfully, but the other file cannot be deleted.

Screenshot of Item Not Found error message

  • The file exists on a local volume (a Samsung PCI-Express NVMe SSD )
  • The volume is formatted NTFS 3.1 running Windows Server 2016
  • The file appears in Windows Explorer and dir (see screenshot above)
  • Attempting to perform any operation on the file in Windows explorer, including Move, Rename, Delete, and Shift+Delete, results in this error message:

    Item Not Found
    Could not find this item
    This is no longer located in C:\git\redacted\
    Verify the item's location and try again.

    DemoServiceClient.cs~WIP
    Type: File
    Size: 8.35KB
    Date modified: 2017-12-14 12:30

    [Try Again] [Cancel]

  • The File Properties dialog is empty:

    enter image description here

  • The File Properties dialog's Security tab says:

    The requested security information is either unavailable or can't be displayed

  • The total filename length is 130 characters, well within MAX_PATH (260 characters)

  • The file appears in dir /a as a normal file (i.e. not an NTFS link or reparse point):

     Directory of C:\git\redacted
    
    2017-12-14  12:36    <DIR>          .
    2017-12-14  12:36    <DIR>          ..
    2017-12-14  12:30             8,559 DemoServiceClient.cs~WIP.
                1 File(s)          8,559 bytes
                2 Dir(s)  223,416,360,960 bytes free
    
  • Running del DemoServiceClient.cs~WIP gives me this error:

    Could Not Find C:\git\redacted\DemoServiceClient.cs~WIP`

  • chkdsk reported no issues:

    Stage 1: Examining basic file system structure ...
      1140992 file records processed.
    File verification completed.
      19089 large file records processed.
      0 bad file records processed.
    
    Stage 2: Examining file name linkage ...
      1527444 index entries processed.
    Index verification completed.
      0 unindexed files scanned.
      0 unindexed files recovered to lost and found.
    
    Stage 3: Examining security descriptors ...
    Security descriptor verification completed.
      193227 data files processed.
    CHKDSK is verifying Usn Journal...
      34291080 USN bytes processed.
    Usn Journal verification completed.
    
    Windows has scanned the file system and found no problems.
    No further action is required.
    
     499526655 KB total disk space.
     290439980 KB in 856509 files.
        464848 KB in 193228 indexes.
             0 KB in bad sectors.
       1258155 KB in use by the system.
         65536 KB occupied by the log file.
     207363672 KB available on disk.
    
          4096 bytes in each allocation unit.
     124881663 total allocation units on disk.
      51840918 allocation units available on disk.
    
4
6

I'm just adding this here for anyone whose google search guides them here. After failing all normal, cmd and powershell options, I got the problem solved by a small trick.

  1. Get some program which reads and makes compressed files. I used 7 zip, WinRar will probably work too.

  2. Right click the bad file and click Add to Archives. Then in the options select to delete original file after compression.

  3. Leave other options same and proceed. Bad file will be deleted and a compressed file will be created in its place.

  4. The problematic naming structure changes with addition of extension (.zip .rar .7zp etc) and can be deleted.

3
  • 1
    Thank goodness this was messing up my git directory. Also, right-clicking on the file to use 7zip didn't provide the menu option but once I manually open 7zip I was able to use it to rename and delete the file. – Nick Peppers Sep 2 '20 at 20:37
  • A simple, elegant solution, that works flawlessly. Upvoted. Thank you. – Apache May 8 at 21:57
  • That worked perfectly. Thanks. Windows was stating the file doesn't exist and I was unable to rename it, move it, delete it, etc. – Emmanuel Goldstein May 28 at 16:49
6

I had the same problem and found a solution here.

Edit: You will HAVE to move/rename the file into a folder you can delete with the provided solution (or check if you can already delete the file's parent folder, if possible).

Edit2: NTFS (or Windows itself) does not like/allow for file names to end with a dot or a space. You need to remove the dot/space from the file/folder name. You may need to to it from a DOS prompt (CMD), but then you may also be able to just delete it from CMD.

Commands to try: del, rd, move and ren

Here goes Rayza73's answer for reference.
I tried pretty much all he did, and also tried renaming the folder a few times.

I had this same problem using Server 2012 Std. I tried various options of taking ownership of the parent folder because the Security properties of the folder I was trying to delete were blank, using CMD and Dir /x etc. I even tried sharing the parent folder and then using Server 2008 R2. None of them worked. When I tried Dir /x Server 2012 doesn't show the 8 character filename with the ~1. I tried typing it in myself, but that didn't work either. I then found that there was a space at the end of the folder name. I then tried all the CMD options again using a space, still no luck. Then I finally stumbled upon this solution:

Open CMD and then type:

rd /s "\\?\D:\bad\folder\path "

example:

rd /s "\\?\D:\Sharedata\folder1\folder2 "

note the space after folder2 as per the space in the folder name.
Obviously D: is the drive that has the folder on it.

In my case there was no space or dot in the end of the folder name, just a stubborn folder left on a failed Teracopy run. But my folder had several folders inside it that could not be deleted.

This did the trick.

My run was:
rd /s "\\?\G:\Backups\MacMini\BADFOLDER"

If it is a file instead of a folder, just adjust the command. The command rd stands for "remove dir", so it makes no sense to use it in a file:

del "\\?\D:\Mainfolder\folder1\myfile."

You could also try to move it somewhere else before deleting it, if you are having problems.

Tip: You can use TAB to autocomplete the Files and Folder names in cmd. Repeating TAB will give you the next choice.

2

Understand this is an old thread, however while trying to find a solution to this exact same error I've read a number (more than id like) of threads now of which was a total wild goose chase.

I was unable to do what other threads suggested: Unable to delete, move, rename or archive for deleting (file appeared via dir commands however). If this fits the bill for you then the following thread provided a working solution in my case and has similar feedback.

I just encountered this issue after having extracted files, which placed a "b." file on my desktop - this may also work if your file ends in a space.

The suggested "solutions" above have not worked in my Windows 10 machine (1909). Credit to Micha on the below thread - Wasn't what I was looking for due to "windows 7" being in the title, however did work in my case.

How to delete a file ending in a dot in Windows 7?

Launch Command prompt as admin and modify the below to your needs.

del "\\?\<full path to file>"

Example:

del "\\?\C:\Users\Username\Desktop\filename."
-1

My case was identical; A file name that contained a dot in the end : "John notes of February." (Windows 7) The steps recommended here didn't help. The "dir" command returned the same thing; the file name with the dot in the end. I opened the Command Prompt (cmd). I switched to the Desktop folder (chdir). I checked that no other file started with thw word "John" (dir). I entered the command : DEL John* And the problem was solved. I restarted Windows to confirm that the problem didn't occur again. However, we are talking about Windows 7. I can't be sure that the file won't come back by itself in the future. Warning: if there is any other file that starts with the word used (John), it is going to be deleted as well, and it won't go the the Recycle Bin.

Not the answer you're looking for? Browse other questions tagged or ask your own question.