Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a rather large number of files on my Windows drive that have a colon in their name. (These came from unpacking some Unix archives.)

When I try to delete them, Windows (XP) complains that the file does not exist, and refuses to delete it. This happens when trying to delete or rename it from explorer or the command line. Still, chkdsk does not complain about those files nor fix the problem.

Any ideas on how to get rid of them?

share|improve this question
Will it let you rename them or move them to a different location? If you can move them, try putting them all in one directory, then deleting that directory. – nhinkle Jul 19 '10 at 18:16
Technically, they are valid, it is Windows Explorer that is invalid^W special needs file manager. – Alexei Averchenko Jul 26 '13 at 7:43
up vote 5 down vote accepted

You may be able to use this syntax (per Microsoft KB 320081):

del "\\?\c:\path_to_file\bad:name.ext"

See also this serverfault question on the same topic, "delete file containing invalid characters in windows".

I think the old "ntfsdos" sysinternals utilities could remove/rename these files as well, but these are no longer available post-MS acquisition.

share|improve this answer
@Hello71 (to @Ruggle Humsteader) - new users can't comment, they can only answer (they presently need 50 rep points for that: ). They can comment on their own questions and answers, though. (Just so other new users aren't confused by your request.) – michael_n Mar 29 '11 at 14:28
How would you make such a file from Windows? – cutrightjm Jul 26 '13 at 4:29
@ekaj - the file could be created using another OS. Create a screenshot in Ubuntu, it has colons in the filename. Then open it in Windows - that won't work. – SPRBRN Jul 26 '13 at 8:01
@rxt I'm aware. My point is if you can delete it, you can probably make it some how. – cutrightjm Jul 26 '13 at 14:49
doesn't work for me in Windows 7 – Populus Jan 25 '14 at 23:35

You may want to try booting from an Ubuntu Live CD and deleting it from there.

share|improve this answer
Yesterday I saved a screenshot in Ubuntu, then tried to open that in a Windows VM. It refused to open, bad file type or something. Then I realised it could be the colon in the filename, which I couldn't remove in Windows. I change the name in Nautilus, and then I could open the file. – SPRBRN Jul 26 '13 at 7:59

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.

[Click here for 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.

share|improve this answer
I wish it showed you a list of what it was going to fix, but this worked for me in Windows 8.1. – ToastyMallows Mar 2 '15 at 23:40
first thing that helped me, after like 20 tries. This uses chkdsk which fixes lots of stuff. – Horst Jahns Dec 19 '15 at 11:33

To fix this on Windows 7:

chkdsk C:/r
share|improve this answer

Another alternate that you may want to try is to bring in CygWin, a bash shell for windows. This would allow you to apply UNIX commands to your DOS folders.

share|improve this answer
If you regularly deal with unix files on a windows machine, it's always a good idea to have cygwin installed. Otherwise it might suit you better to boot and delete the file from a linux live CD when the situation arises. – Marnix A. van Ammers Jul 19 '10 at 19:42
Unfortunately, I have tried cygwin, and that does not help. 8-{ Even cygwin is not able to remove the files. – hstoerr Jul 20 '10 at 7:02
cygwin tools still relies on the windows API to delete files. If the Windows API refuses the filename, nothing can be done from Windows with standard file tools. I also recommend to access the filesystem from an alternate OS. – dolmen Mar 26 '11 at 21:09
I've just tried accessing a file with colons on an ext3 drive with Cygwin and even that doesn't work. – this.lau_ Nov 2 '15 at 22:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .