Loading ...
Sorry, an error occurred while loading the content.

Re: [BATCH WORLD] clean useless files efficiently

Expand Messages
  • John O'Regan
    Hi Aristos! Try the following. Run the program and make sure the output is correct before deleting ECHO on the second last line. The two commented lines are
    Message 1 of 2 , Dec 22, 2011
    • 0 Attachment
      Hi Aristos!

      Try the following. Run the program and make sure the output is
      correct before deleting ECHO on the second last line. The two
      commented lines are an example of how you can change directory and
      start deleting folders relative to the new directory.

      Please note this program only finds folders that match the string
      supplied by the CALL statement at the beginning of the directory name.
      For instance,

      CALL :_deltree "lime"

      would match all folders in the current directory such as "Lime",
      "limestone" or even "limey", but not "Slime" or "Lemon and Lime",

      good luck,
      John

      - - - -

      @echo off & setlocal enableextensions disabledelayedexpansion

      cd /d %SystemRoot%
      call :_deltree "$NtUninstall"
      call :_deltree "$MSI31Uninstall"
      call :_deltree "$NtServicePack"
      call :_deltree "$UninstallRDC"
      call :_deltree "$hf_mig"

      :: cd /d %UserProfile%\Local Settings
      :: call :_deltree "Temp"

      endlocal & exit /b 0

      :_deltree
      for /f "delims=" %%f in ('dir /b /ad "%~1*"') do ^
      echo rd /s /q "%cd%\%%~f"
      goto :EOF
    Your message has been successfully submitted and would be delivered to recipients shortly.