http://www.anetforums.com/posts.aspx?ThreadIndex=233 Discusses some tecniques for cleaning up crap folders and files written by ftp users.
@echo off echo WARNING! This will prompt and then remove echo all folders under the current folder: cd echo which have long names or illegal names, echo leaving only those folders with standard echo 8.3 names. pause @for /F "tokens=3,4,5" %%A in ('dir /x/ad') do if "%%A"=="<DIR>" if not "%%B"=="%%C" if not "%%C"=="" rd %%B /S
Certain folders with special names like the names of devices or reserved names(AUX/NUL/LPT1/COM!) can be removed using a trick from the following Microsoft Knowledge base article: http://support.microsoft.com/support/kb/articles/Q120/7/16.ASP.
The article states that you can't remove files with reserved driver names (i.e AUX, CON...etc) since a check of reserved words is performed any time you perform a file/dir operation. Fortunately, another option exist to bypass the normal reserve-word checks altogether. You may access your directories via Universal Naming Convention (UNC).
Tou can possibly delete any file with a command such as:
DEL \\.\driveletter:\path\filename
For example:
DEL \\.\C:\inetpub\ftproot\com1 /S/Q
RD \\.\C:\inetpub\ftproot\com1 /S/Q