27

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?

grom
  • 819
  • 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 03 '10 at 06:18
  • Related: https://superuser.com/q/31587/320611 – David Refoua Apr 17 '17 at 19:24

14 Answers14

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.

Joe
  • 2,103
Ausmith1
  • 1,199
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

13

This worked for me:

  1. Ran chkdsk /f
  2. Rebooted PC
  3. Then I was able to select and delete the file
JohnB
  • 497
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.

zkanoca
  • 113
  • 1
  • 8
  • 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. – Umur Karagöz Apr 02 '20 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. – user2070305 Oct 12 '22 at 00: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.

Dentrasi
  • 3,772
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 *:*

Joe Internet
  • 1,449
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 ;)

  • 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 08 '16 at 11:48
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).

joeqwerty
  • 110,860
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.

YH Lee
  • 1
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

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

womble
  • 97,049
0

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

Michael Kohne
  • 2,344
  • 1
  • 18
  • 29
  • You I tried wildcards. No luck – grom Dec 22 '09 at 02: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. – Michael Kohne Dec 22 '09 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. – user2284570 Feb 03 '15 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. – Michael Kohne Feb 03 '15 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. – user2284570 Feb 03 '15 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).

Michael Kohne
  • 2,344
  • 1
  • 18
  • 29