1

I have "This is no longer located in C:\Users\Karina. Verify the item’s location and try again" error when I try to move/ delete/ open file situated in my "Users" folder. It appeared because I wanted to create .gitignore but ended up creating .gitignore. — I didn’t spesified the extension. I tried to rename it with Command Promp by this command:

DIR /A /X /P
RENAME (name of the problematic file) (some other name)
EXIT

But it says it couldn’t find this item either. I know we can delete a file in Command Promp too but I am a bit afraid to try it out, as it is just a file, not a folder — so when I will type a file location, I will type C:\Users\Karina. Won’t it delete my "Karina" folder entirely?

Surprisingly I can open up this .gitignore. in my Photoshop. So I wanted to save it after editing it there, just so I can later delete it. But I cannot do that too.

torek
  • 448,244
  • 59
  • 642
  • 775
Karina
  • 57
  • 1
  • 9

2 Answers2

0

Try first to delete that file (or rename it), using a CMD opened with elevated privileges:

del "\\?\C:\full\path\to\.gitignore."
# or
ren "\\?\C:\full\path\to\.gitignore." "\\?\C:\full\path\to\.gitignore"

Then you can see if the move proceeds.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • It says "the system cannot find the path specified", when I try to rename it through CMD – Karina Oct 11 '21 at 06:49
  • @Karina Do you see it in the Windows explorer? – VonC Oct 11 '21 at 06:50
  • I see it as a response on my command in cmd – Karina Oct 12 '21 at 11:39
  • @Karina I understand, but do you still see the `.gitignore.` file? (either in a file explorer, or in your CMD, with a `dir` in the parent folder) – VonC Oct 12 '21 at 12:14
  • yes, I still see it in the file explorer too – Karina Oct 13 '21 at 02:20
  • @Karina `del "\\?\C:\full\path\to\.gitignore."`: you did replace the `full\path\to` part of the command by the actual full path of that file? – VonC Oct 13 '21 at 05:28
  • Yes, of course! Is there any possibility it may really not be located there though I can see it? – Karina Oct 14 '21 at 06:20
  • @Karina No, it should be here. Any chance there is a typo, or a space after the file name, as in '`.gitignore. `'? – VonC Oct 14 '21 at 06:39
  • So I am writing `\\?\C:\Users\Karina\.gitignore.` — is that correct (considering this is the correct full path where I can see this file)? If so, then no, there is no typos – Karina Oct 14 '21 at 07:33
0

This one worked for me after several searches

rd /s \\?\Drive:\bad\folder\path

This will delete the folder containing the problematic file

dougMcarthy
  • 49
  • 1
  • 5