(Redirected from Deleting files with special characters in their names, in Windows)
A couple of directories in Windows couldn’t be deleted by Windows Explorer, because they had unprintable characters (I’m assuming) in their names.
D:\tmp>dir Volume in drive D is Data Volume Serial Number is 8C47-34BD Directory of D:\tmp 28/09/2012 11:34 AM <DIR> . 28/09/2012 11:34 AM <DIR> .. 26/10/2010 01:51 PM <DIR> 954321. 0 File(s) 0 bytes 3 Dir(s) 89,164,262,548 bytes free
On on hitting Delete it replied "Could not find this item. This is no longer located in D:\tmp". I tried on the command line, a similar error:
D:>rd 954321. The system cannot find the file specified.
The security properties of the folder looked weird, saying "The requested security information is either unavailable or can't be displayed.":
So I faffed around trying to change ownership, filenames, etc. all with no luck. Nothing seemed to see these files as existing except for Windows Explorer and
In the end Superuser came to the rescue as it often does, with the suggestion of referring to the file by its shortname, which can be got via
D:>rd /s 954321~1 Are you sure (Y/N)? y
Agh. Why are the simple things so hard to remember sometimes?…