How To Remove Files with Reserved Names such as LPT1 or PRN

by Wayne Maples [Published on 20 April 2004 / Last Updated on 20 April 2004]

Files are sometimes created with illegal or reserved names. The reserved names follow.

CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, PRN, NUL

If you have ever tried to delete a file with a reserved name, it is not normally possible to do so with the del command. NT comes with Posix utilities including rm.exe which is the unix version of delete. NTFS will not allow NT native utilities to delete or rename files with the reserved names. NTFS will allow Posix utilities to do so.

For the file named lpt1:

rm lpt1

If you are uncomfortable with Posix utilities, you can delete such files using the del command, if you fool NTFS into not doing reserve-word checking:

DEL \\.\c:\somedir\lpt1

Almost as ugly a syntax as used in file URLs.

NTFS Tips:

Managing Shared Resources and Resource Security
Choosing Between FAT and NTFS
Web versus NTFS Permissions
NTFS Security, Part 2: Implementing NTFS Special Permissions on Your Web Site
Getting the Most from IIS Security
NTFS Permissions
Cancel an NTFS conversion
NT equivalents of NetWare Rights
Access NTFS from DOS, Win95 or Win98 using NTFSDOS driver
NTFS Last Access TimeStamp
xcopy - keep attributes
How To Remove Files with Reserved Names such as LPT1 or PRN
NTFS Metadata files
Disable NTs 8.3 aliases for LFNs under NTFS
Streams displays which NTFS files have alternate streams content
VolumeID changes NT and FAT volume IDs
Create a NTFS partition over 4GB during installation
Windows NT NTFS Directory Compression

See Also

Featured Links