How to Delete a File that Contains the "CON" Substring?

5

1

The CygWin Environment does not provide a Software Uninstallation Procedure.

Among its leftovers, there is also this File:

C:\Users\DOBRE\AppData\Local\MyApps\CygWin\usr\share\avogadro\crystals\zeolites\CON.cif

All of my attempts to delete it have failed so far. I have attempted:

  1. To delete it using the Total Commander File Management Replacement Software Application.
  2. To delete it using the Total Commander File Management Replacement Software Application run as an Administrator.
  3. To delete it using the CMD.EXE Command Line Preprocessing Software Application run as an Administrator.
  4. To delete it after starting the Microsoft Windows 10 Home Edition x64 Version 10.0.1709.16299.98 Operating System in the Safe Mode.
  5. To delete it after booting from a Microsoft Windows 10 Repair Compact Disk Read-Only Memory.
  6. To repair the C: Software Partition using Symantec's Norton Utilities 2016 Software Application, which has not found any errors.

Please advise.

user539592

Posted 2017-12-08T16:06:08.440

Reputation:

What happens if you try to delete it? Did you try to delete the folder that contains it? – Seth – 2017-12-08T17:48:25.293

It was reporting Access Denied. Yes, I have attempted to delete the sub-tree that was containing it. See the answer below. – None – 2017-12-08T18:39:48.150

Answers

7

MS has a document describing 6 cases where a file cannot be deleted, with remedies. From your description, your situation is covered under the heading "Cause 5".

Cause 5: The file name includes a reserved name in the Win32 name space

If the file name includes a reserved name (for example, "lpt1") in the Win32 name space, you may not be able to delete the file. To resolve this issue, use a non-Win32 program to rename the file. You can use a POSIX tool or any other tool that uses the appropriate internal syntax to use the file.

Additionally, you may be able to use some built-in commands to bypass the typical Win32 reserved name checks if you use a particular syntax to specify the path of the file. For example, if you use the Del command in Windows XP, you can delete a file named "lpt1" if you specify the full path of the file by using the following special syntax:

del \\?\c:\path_to_file\lpt1

For more information about deleting files with reserved names under Windows NT and Windows 2000, click the following article number to view the article in the Microsoft Knowledge Base:

120716 How to remove files with reserved names in Windows

For more information about deleting files with reserved names under Windows XP, click the following article number to view the article in the Microsoft Knowledge Base:

315226 How to remove files with reserved names in Windows XP

If you open a handle to a file by using the typical Win32 CreateFile mechanism, certain file names are reserved for old-style DOS devices. For backward compatibility, these file names are not permitted and they cannot be created by using typical Win32 file calls. However, this issue is not a limitation of NTFS.

You may be able to use a Win32 program to bypass the typical name checks that are performed when a file is created (or deleted) by using the same technique that you use to traverse folders that are deeper than MAX_PATH. Additionally, some POSIX tools are not subject to these name checks.

So I'd recommend you try:

del \\?\C:\Users\DOBRE\AppData\Local\MyApps\CygWin\usr\share\avogadro\crystals\zeolites\CON.cif

Frank Thomas

Posted 2017-12-08T16:06:08.440

Reputation: 29 039

Excellent. It did not even require Administrator Privileges. Thank you. Merry Christmas, Happy Hannukah, May the Force be with you or just simply Enjoy the Season Holidays. – None – 2017-12-08T18:38:43.003

Last year, I replaced a webserver whose content had been moved from server to server for more than 15 years, leaving us with lots of cruft. I ended up having to use 3 different steps from that document for this or that file, including a con.gif file created by an ancient version of ColdFusion run-time. robocopy would copy it, but I couldn't delete it afterward. Now, we have a nice clean webserver so it was worth it, but man, what a pain. – Frank Thomas – 2017-12-08T21:38:31.940

I hear you. I am struggling to perform a Full Software Installation of the CygWin Environment in a correct way. Its System Administrators never recommend performing such a Full Software Installation Process. After lots of trials and errors, I am now hoping to obtain the best results so far, back in the C:\CygWin\ Folder, as elsewhere it is more difficult to maintain. It should reach up to around 87 GigaBytes of Used DataSpace and up to one million Files and Folders. Thanks again for the answer. – None – 2017-12-08T23:01:11.897