26

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?

2
  • 2
    These files were created on the NTFS partition when I was booted into Linux. Guess I will have to use Linux boot disk as it seems windows doesn't like colon in filenames at the file system driver level.
    – grom
    Feb 3, 2010 at 6:18
  • Related: superuser.com/q/31587/320611 Apr 17, 2017 at 19:24

14 Answers 14

26

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.

7
  • 5
    This doesn't work for the colon, as it is interpreted as a named data stream.
    – psusi
    May 3, 2013 at 18:06
  • This worked for my case. the file I was having the issue with contained a comma , Mar 13, 2016 at 3:07
  • Thanks, this worked for me. The file ended in a period. CA848D8F.
    – Mastro
    Jul 15, 2016 at 1:19
  • 1
    Doesn't work. My filename contains a backslash.
    – Pacerier
    Mar 11, 2017 at 11:19
  • 1
    If the file name contains : as the OP has asked about, this method doesn't work. Use chkdsk or delete it from a live linux. Nov 20, 2018 at 18:27
18

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

5
  • How I could be able to do this on an NTFS volume created with theformatcommand with 8.3 names support disabled? Feb 2, 2015 at 14:33
  • 1
    @user2284570 this method won't work. When I wrote that answer, Microsoft had 8.3 names enabled, but these days it is disabled by default. Feb 2, 2015 at 20:42
  • @MarkHenderson, My filename is 7:2. How do I use 8.3 name for filename of 7:2?
    – Pacerier
    Mar 11, 2017 at 11:17
  • @Pacerier see my previous comment. This method won't work on modern operating systems. Windows XP or older. Mar 11, 2017 at 12:49
  • Files with a colon in the name have blank 8.3 filenames and because of the colon it is impossible to add one.
    – BoarGules
    Feb 6, 2020 at 22:47
13

This worked for me:

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

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.

2
  • File I was trying to remove contained a question mark on windows 10, and only this method helped me. Scan the drive and it will ask you whether to repair, click repair and the file will be gone. Apr 2, 2020 at 23:45
  • This worked on Win7 to clean up a file with a ? in the file name that was rsync'd over from a Linux system. Other approaches listed above didn't work. Oct 12, 2022 at 0:35
5

7zip can delete files that Windows fails to; I've used it in the past when dealing with overlong filenames, but I've never tried it on files with colons in. They would normally be used to denote ADS.

6
  • This is because 7-zip use cygwin. Feb 2, 2015 at 14:40
  • 1
    Doesn't work for both my files. First file have filename with backslash and second file has filename with colon.
    – Pacerier
    Mar 11, 2017 at 11:22
  • No, it's because 7-zip uses the Windows API instead of the shell. It has the same limitations as the API: it thinks colons indicate streams.
    – user165568
    Jan 31, 2019 at 4:54
  • 7zip worked for me Oct 10, 2019 at 6:18
  • I used 7zip to rename the file, then delete it. Worked over the network. Apr 15, 2022 at 18:17
4

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 *:*

4
  • POSIX compliant utilities (such as SFU) can delete such files.
    – Ausmith1
    Dec 23, 2009 at 1:00
  • @JoeInternet : sigghh Microsoft removed the all non windows subsystems with 2012 and up. Feb 2, 2015 at 14:16
  • 1
    ... but a unix subsystem is back again in win 10.
    – user165568
    Jan 31, 2019 at 4:49
  • rm from MinGW or Git works too. Mar 15, 2023 at 2:25
1

Try renaming the parent folder to a single character (a, 1, etc.) and then try to delete the parent folder. If it doesn't work then move to the first child folder and rename it to a single character and try the delete again. I often use this method for files with invalid characters (don't ask me how they get created because I don't know) or for files where the path exceeds the maximum (again, don't ask how this occurs).

1

I have a dual boot system, and non of the above answers worked for me. If the file is located in a disk that is mounted by your other OS (Ubuntu 16.04 LTS for me) you can simpy delete it using your other OS ;)

1
  • This is fairly reasonable when in a bind (though cannot be done to an online machine). Also, native dual boot isn't required, as we can boot a live distribution to do this such as the Fedora installer disk or Knoppix. HOWEVER, one should be careful when in an environment like this, as the NTFS3G driver that we use to mount this system won't respect most Windows permissions / ACLs (which is exactly why it's so effective at getting rid of "stuck" files).
    – Spooler
    Oct 8, 2016 at 11:48
0

Have you tried quoting the filenames? Giving the exact command that you're running would be handy.

1
  • I have added it to the exact command I'm running to question.
    – grom
    Dec 22, 2009 at 2:57
0

Have you tried using a wildcard? For instance 'del 1d67c0d23e859ed4a259749e4a720d9e*.*' might work.

5
  • You I tried wildcards. No luck
    – grom
    Dec 22, 2009 at 2:55
  • 1
    The next thing that I think of is to boot the system with a linux cd (like system rescue cd), mount the volume there and try the delete from there. You might get interesting results at that point, as who knows what's really going on in the filesystem. Dec 22, 2009 at 18:32
  • @MichaelKohne : I think using a Unix path implementation is the right solution too. But why using linux? windows is run as an NT subsystem, and there is already a POSIX/Unix NT subsystem. Feb 3, 2015 at 13:02
  • 1
    @user2284570 - because given the fact that they were created with Linux, it seems likely that the linux NTFS driver allowed something that it shouldn't have, which even the Windows POSIX shell may not be able to slip past the filesystem driver. Much simpler to boot a live linux CD, remove the bogus file, and reboot back to Windows. Feb 3, 2015 at 13:26
  • @MichaelKohne : No, because UNC paths already work (native subsystem), and the with the POSIX subsystems there is no direct access to alternate data streams, so you can use:inside files. Feb 3, 2015 at 13:40
0

Have you tried dir /X to find out the actual 8.3 name, and then tried deleting that name?

Or, could that file have an alternate data stream? You might want to look at it wil the tool at http://www.nirsoft.net/utils/alternate_data_streams.html to see what that can tell you (I've never used that tool, it just came up when I searched).

0

I had a folder with a commma in the name. I tried a few of the above suggestions and could not get them to work.

I was able to delete the folders with cygwin. Installing that app isn't for everyone, but it will do the job.

0

None of the above suggestions worked for me. I used WinRar. Open winrar and you will see a list of files, where you will the suspect file "filename " (which was created by you as "filename : some_text.txt". Rename the file in Winrar and provide it an extension (like .txt or .doc).

Go back to Windows Explorer you will see "filename .txt" (Or doc). Delete it from there.

0

7zip comes to my rescue - I have a PDF file that has a name that is not only long (can deal with by finding out the short name), it has " " in it. 7zip cannot delete it, but it can RENAME it! I rename it to 1, and the next thing is just putting it in the recycled bin.

You must log in to answer this question.

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