Monday, February 27, 2017

ntfs - How do I delete a file that Windows says doesn't exist?

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
    .
    2017-12-14 12:36
    ..
    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.

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...