Cannot create a folder because such folder already exists?

1

Running under Windows 7 Enterprise SP1 x64.

When I try to create a folder with a certain name (for reference, let's assume it's X:\MyFolder, I'm getting this:

enter image description here

The name I am using does not show as a folder in Explorer, Total Commander or Far.

The name consists of Latin characters and an underscore, <20 characters long, being created under a drive's root (so no long names issue).

Any other folder name works fine.

I tried restarting - it did not help.

I tried a check disk - it did not find any errors.

  1. What could be preventing me from creating a folder with this name?

  2. Is there any other cleanup I can do on my file system, to get rid of this ghost somehow?

For those wondering, this is not a random name, it was destination path for Copy-Item command in Powershell, it failed to create this folder for some reason, now it keeps haunting me. :) The issue has been happening ever since, and only for this specific folder name, at this specific path.

Neolisk

Posted 2014-01-06T21:13:29.840

Reputation: 589

Could you post the PowerShell code for us to have a look at it? – Darius – 2014-01-06T21:17:10.777

@Darius: I don't have this code anymore. But the statement that caused this behavior was trying to copy into a folder which did not exist. I forgot about a -Force statement, then I found that -Force does not work for files, only for folders, so I went with a different approach. I did not use source control, unfortunately. And I am not even sure if the issue is Powershell related - I cannot reproduce it. :) – Neolisk – 2014-01-06T21:23:37.643

So the earlier part of the PowerShell code was supposed to create a folder and then copy some "stuff" into it? – Darius – 2014-01-06T21:28:59.533

@AxelKemper: You are right. Time to end my working day and get some sleep I guess. I deleted a file with the same name (not sure how it got there though), now it's fine. Please post as an answer to be accepted. – Neolisk – 2014-01-06T21:30:13.910

@Darius: Correct. And somehow instead of copying stuff into a folder, it created a file with this folder's name (and no extension). See Axel's comment. – Neolisk – 2014-01-06T21:31:05.210

Yeah, I can repo the problem and I think I know what was wrong with the code. It was taking the whole file name with its extension and trying to apply that to the folder name which resulted in the error message you posted in you question. – Darius – 2014-01-06T21:40:42.260

Answers

1

As said in the message text: This error message comes up, if a file (!) of the same name exists already. Windows does not allow a file and a folder to share the same name.

Axel Kemper

Posted 2014-01-06T21:13:29.840

Reputation: 2 892

Nor does any OS or filesystem that I know of. – user1686 – 2014-01-06T22:40:47.090

1Yes, but systems like Google Drive at least allow multiple files to have the same name. The timestamp is taken as distinction. – Axel Kemper – 2014-01-06T23:07:35.517

Now there's a radical idea: actually read what the error message says :) – dangph – 2014-01-07T00:24:04.977