2

I have a movie named Con Man. Apparently, in Windows, you cannot have a file name with the name CON in it. Can anyone please help me delete it?

It is stored in F:\Movies\Con Man The name of the file that I want to delete is Con.Man.2018.720p.WEBRip.x264-[YTS.AM]

I know there are a lot of similar issues but I am not able to apply them that is why posting here. Thankyou

PS :: I am a noob!

Edit: Found this on the internet but cant work it out https://www.itechtics.com/how-to-createdelete-a-folder-named-con-in-windows/

  • I am not able to delete it. the error is "Invalid File Handle" – Rishikesh Mar 7 '18 at 9:30
  • Did some tests, Con is a name of a device, and using con. will make both windows and command prompt fail given that it tries to access a device. Testing powershell now. I think Powershell is smart enough to do this. – LPChip Mar 7 '18 at 9:31
  • What is the extension of the file? del "F:\Movies\Con Man\Con.Man.2018.720p.WEBRip.x264-[YTS.AM].<EXTENSION>" <- change <EXTENSION> to mkv or mp4 or whatever – mcalex Mar 7 '18 at 9:34
  • Nope, Powershell can't do this either. That means you will need to use linux or another OS to actually get rid of this file. You can download a linux live cd and boot from that and rename or delete the file there. All it can't have is con. the rest is fine. – LPChip Mar 7 '18 at 9:34
  • 1
    @mcalex just try to rename a textfile on your windows system to a file called con.man.txt and you'll find out it will fail. – LPChip Mar 7 '18 at 9:34
7
  1. Open Command Prompt
  2. Type del "\\.\F:\Movies\Con Man\Con.Man.2018.720p.WEBRip.x264-[YTS.AM].mp4" then press Enter

This works because the \.\ prefix will allow access to the drive directly without going through some drivers which prevents access to con files.

The error message occurs appears when the file you are trying to delete is given a reserved name. Using reserved names is prohibited by Microsoft and should not be trifled with.

The Microsoft Naming Conventions provide that files or folders on your system should not be named CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. This is because these names are reserved names in the Windows operating system, meaning they are used for a specific purpose by the Windows operating system and should not be used anywhere else. You should also avoid following the above names immediately by an extension, for example, NUL.txt. In case you want some more details, you can refer to this article on Microsoft’s website.

Source

| improve this answer | |
  • Do you mind explaining why that works and the other way doesn't? – mastov Mar 7 '18 at 10:34
  • 1
    @mastov This works because the \\.\ prefix will allow access to the drive directly without going through some drivers which prevents access to con files. – iTechieGamer Mar 7 '18 at 12:40
0

You'll have to use the command line. Start it by typing cmd in the Start menu and pressing Enter.

In the command line window, type this command:

del "\\.\F:\Movies\Con Man\Con.Man.2018.720p.WEBRip.x264-[YTS.AM].mp4"

It should get rid of the file. Similar commands can be used for other problematic files.

(By the way, the .mp4 extension is my guess because you haven't provided it. It may actually be different, adjust it accordingly.)

If the folder also resists deletion, empty it and use this command:

rd "\\.\F:\Movies\Con Man"
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.