difficult Windows issue today. A user had the problem that he could not delete a Folder (C:\Temp\orders) , also renaming or moving is not possible. The same behaviour with the command line tools rmdir, ren and move.
The folder was created from Excel with a vba macro.
The error message was: Cannot delete file: Cannot read from the source file or disk.
No properties were shown in Explorer for this directory and the security tab is missing. It seems the folder isn’t present anymore. Is there a filesystem corruption? After a chkdsk run the folder is already present.
I started cmd.exe an dived into the directory by using the tab key to complete the Foldernames automatically. And whats that:
D:\>dir "C:\temp\Orders "
There is a trailing space and the end of the directory name. Should this be the problem?
I tried to delete the folder with this command line:
rmdir "\\?\C:\temp\Orders "
With the \\?\ prefix I was able to delete the folder. The leading \\?\ tells the Win32 API to bypass some integrity checks.
I found out that Folders with a trailing “.” are also affected.
It is repeatable on all Windows versions. Use the Perl mkdir function
#!d:\perl\bin\perl.exe mkdir "C:\\temp\\Orders \\";
On Vista or higher versions the error message differs from the XP or Server 2003 ones:
Could not find this item. This is no longer locate in C:\Temp. Verify the item’s location and try again.