Windows – Delete file containing invalid characters in windows

windows

I have some files that contain colon character in the filename (eg. 1d67c0d23e859ed4a259749e4a720d9e:default-sink). When I try to remove them from command line with the command:

c:\backup> del /F *.*

I get "The system cannot find the file specified." for each file. If I specify an individual file:

c:\backup> del /F "1d67c0d23e859ed4a259749e4a720d9e:default-sink"

I get "The filename, directory name, or volume label syntax is incorrect.". If I try to use rd on the parent folder I get

How can I remove these files?

Best Answer

There is a Microsoft KB article listing possible ways to delete such files at:

http://support.microsoft.com/kb/320081

The way I typically use is the native API method:

del "\\?\c:\path\1d67c0d23e859ed4a259749e4a720d9e:default-sink"

According to:

http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx

The : is a reserved character on NTFS, the native API method I mentioned above is the recommended way to delete such files.