Monday, December 29, 2014

Tip: Delete Files with Illegal or Reserved Names

Sometimes an application will create a file that has an "illegal" file name (that is, a name that's reserved by the operating system, such as CON, COM1, AUX, LPT1 or PRN). If this happens, you may not be able to delete these files using the graphical interface. Here's how to delete them:
  • If the partition on which the files reside is formatted in FAT, at the MS-DOS prompt, type DEL and then the file name with wildcard characters, such as DEL LPT?.*
  • If the partition is NTFS, you'll need to use a syntax that bypasses the normal reserved word checks: DEL \\.\(drive letter):\(path)\(file name) (for example: DEL \\.\c:\myfolder\lpt)