If you have an FTP site based on Microsoft IIS and you have a directory which can be uploaded to and subsequently downloaded from, it is possible (if not likely) that at some point it will be detected by a port scanner and someone will use it to transfer MP3s or warez. When they do this, they will create a funky directory path to make it harder to remove. One of the entries will invariably be similar to the name of one of Windows' named pipes; COM1, LPT1, et cetera. There are generally also directories with spaces on the ends of them.

This kind of "tagging" can happen to FTP sites on other operating systems, but Windows is the only one I'm aware of which has named pipes which are reserved filenames. On Unix-based systems, just remove the directories normally.

The names with spaces on the ends will fall to deletion from the Windows Explorer readily enough, but the names similar to named pipes are the really tricky part. You cannot delete or rename them or anything below them in the directory structure from explorer. In other words, if you have

c:\inetpub\ftproot\tagged by\com1000\for all users \

And note the space at the end of the last dir, please -- You will not be able to delete any of those directories. "tagged by" cannot be deleted because it is not empty, and "for all users " cannot be deleted because it is inside a directory whose path is invalid.

The solution is to use DIR /X in the Windows NT Command-Line Shell (CMD.EXE) to get the DOS equivalent filenames of each directory. For instance, com1000 might turn out to be "COM100~1", and for all users would almost certainly be "FORALL~1". So simply CD into the dos equivalent filename for the invalid directory and rmdir the dos equivalent of the directories it contains. Then CD to the parent (..) and rmdir its DOS equivalent filename. (In this example, rmdir COM100~1.)

This trick is also necessary for deleting directories with spaces at their ends from the CLI shell. This method will work at least for Windows 2000 and Windows XP, and most likely on Windows NT4.

Log in or register to write something here or to contact authors.