No announcement yet.

Delete files/folders on Win2000 with special characters and

  • Filter
  • Time
  • Show
Clear All
new posts

  • Delete files/folders on Win2000 with special characters and

    We did today find out that one of our Windows2000 servers for some time has been running with FTP anonumous access allowed, and local Aministrator as the security account . As a result of this there seems to be 18 GB of data on the server which we want to remove . The files and folders names contains both "reserved words", "special characters", "spaces in front/end of names", "very long names" and "very deep paths" (number of levels).

    When trying to delete from script/cmd-window or explorer we get the message "Path not found" or "Cannot delete file:Cannot read for teh source file or disk". Looking for suggestions of how to remove the files and folders.

    Script-based cscript/wscript solution would be prefered (to incorporate logging) before other solutions.

    Examples of directories may be:
    E:\Inetpub\ftproot\ \ . %d .con 1.83 \ . %d .lpt1 2.52 \. %d .lpt2 2.14 \ ;[[Scan By scootmen]];

    E:\Inetpub\ftproot\ \ . com3 2.33 \ÿÿÿ .aux2 ÿ\ . &20 .lpt2 .. \

    E:\Inetpub\ftproot\ J 38483 \ . %d .nul 2.14 \ . %d .lpt3 3.05 \. %d .lpt3 1.2 \ ;[[Scan By hirko]];

    E:\Inetpub\ftproot\t 11197 \prn.hsp.laserjet \com2 \lpt1 \aux \com2 \lpt2 \aux0 \com1 \prn.hsp.laserjet \lpt2 \Scan By m\Tagg By m\Up By m\For m\Here\scan m

    E:\Inetpub\ftproot\w 85010 \aux \com1 \aux0 \com3 \com2 \aux \lpt3 \com1 \aux0 \lpt1 \lpt1 \com2 \lpt2 \aux0

    Thanks in advance

  • #2
    Anyone who has left anonymous access on for very long has had this occur, damn script kiddies. Unfortunatly I don't believe that there is an eloquent solution to this, such as a script to remove the some what random structure. You're probably going to find that it is tedious to remove.

    Microsoft has a tool RM.exe which is the Unix command to remove files/folders and it doesn't care if the object name is reserverd or blank. It was originaly part of the resource kit - "POSIX Utilities" but I think MS removed it from the kit when they created Unix Services for Windows (which is >200MB). Get RM.exe here.

    Read the KB articles below before you start deleting files because they offer some tips and alternatives to using RM.exe, good luck.

    These KB articles might help.;en-us;120716;en-us;811176

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **


    • #3
      Almost there

      Thanks !
      RM functioned almost perfectly, and I was able to remove all but one of the directories using rm r "//<diskname>/<ftplocation>/<subdir>".

      The subdirectory which refused to cooperate had the name ". ", assumes that the use of "." is confused with current directory by the rm-command. The respons from the rm-command was (tested both with ". " and "\. " as directoryname:

      rm -r "//<diskname>/<ftplocation>/. "
      rm: //<diskname>/<ftplocation>/. / TagNjW') / Tag_#~8l : Permission denied.
      rm: //<diskname>/<ftplocation>/. / TagNjW') : File exists.
      rm: //<diskname>/<ftplocation>/. : File exists.

      Any hint on how to remove these last traces would be appreciated.


      • #4
        Excellent I'm glad to hear that it worked well.

        So the last few things... When using dir/x do the folders/files in question have a shortname? They might show up as blah~1, try using rmdir /s to remove the folder and its contents. Alternatively use del and rd to empty then remove the folder.

        Good luck.

        ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **