Delete file containing invalid characters in 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?


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.


I guess you can try the 8.3 name?

del /F 1d67c0~1

Note that on NTFS drives you can explicitly disable the 8.3 functionality, so if that's the case you're outta luck for this option. To get the file name dir a dir /x

There used to be a freeware tool called delinvfile but they've gone and changed it to shareware/paid


This worked for me:

  1. Ran chkdsk /f
  2. Rebooted PC
  3. Then I was able to select and delete the file

Close all the files, if any opened, that are saved in the drive which is containing such files. Now, Open the drive properties.

"My Computer" -> "Right Click on the this drive" > properties

Then, go to "Tools" tab and click "Check now" under 'Error checking' label.

enter image description hereClick here for larger image

This will unmount your drive and will scan the complete drive for errors, eventually it will delete such files with illegal names. On finishing it will show a messages saying some files were fixed.

I successfully deleted such files from my external hard disk.


I have Subsystem for UNIX-based Applications installed on my PC (Windows 7). From the Windows shell, I can create a file with touch 1d67c0d23e859ed4a259749e4a720d9e:default-sink, then remove it with rm *:*