how to delete files with reserved names

Because programs control the policy for creating files in Windows, files sometimes are created by using names that are not valid or reserved names, such as AUX, CON, NUL, and PRN, or LPT1. This article describes how to delete such files by using the standard user interface.

NOTE: You must be logged on locally to the Windows computer to delete these files.

If the file was created on a file allocation table (FAT) partition, you may be able to delete it under MS-DOS by using standard command line utilities (such as DEL) with wildcard(s). For example:
  • DEL PR?.*

    -or-
  • DEL LPT?.*
Another option is to use a syntax that bypasses the typical reserve-word checks completely. For example, you can possibly delete any file with a command such as:

DEL \\.\driveletter:\path\filename

For example:
DEL \\.\c:\somedir\aux

If the name in the file system appears as a directory, use the following syntax.
For example, you can possibly delete any directory with a command such as:

RD \\.\:\\

For example:
RD \\.\c:\somedir\aux

-or-
RmDir \\.\:\\

For example:
RmDir \\.\C:\YourFTP_ROOT's_PATH\COM1 /s /q

/s
-This switch removes all directories and files in the specified directory and also the directory itself. This switch also removes a directory tree.

/q-This switch stands for Quiet mode. Do not ask if you can remove a directory tree that contains the /s switch.

No comments: