Folks, I have a script that I wrote to go through my HDD's, find any directory that has temp or temporary in it, and delete the entire contents and sub contents. With a 32 bit system, I used to just copy deltree to my system32 directory and use that command within my script. But with x64, that is not compatible.
Does anyone have a program that works similarly? I know I can use RD /S /Q which achieves almost the same thing, but if the directory is not empty, it will fail. Does anyone know of a way to accomplish what I am looking for?
BTW, Here is the script if anyone is interested...
Does anyone have a program that works similarly? I know I can use RD /S /Q which achieves almost the same thing, but if the directory is not empty, it will fail. Does anyone know of a way to accomplish what I am looking for?
BTW, Here is the script if anyone is interested...
Code:
@echo off
REM ########################################################
REM # #
REM # Author: John V. Nelson #
REM # Date: 09 - 04 - 2009 #
rem # Notes: Ensure you have DELTREE installed in #
rem # System32. This batch file with search out #
rem # all directories with TEMP or Temporary and #
rem # remove the contents but leave the directory. #
REM # #
REM # Use: To run, type DelTempDirs.bat TempDirs2.txt #
rem ########################################################
cd c:
REM Write directories out that need to be cleaned
rem
if exist c:\scripts\TempDirs2.txt del /q c:\scripts\TempDirs2.txt
dir c:\*temp /a:D /s /b > c:\scripts\TempDirs.txt
dir c:\*Temporary* /a:D /s /b >> c:\scripts\TempDirs.txt
REM Add the backslash "\" to the end of each line so the directory does not get deleted itself
set addtext=\
for /f "delims=" %%l in (c:\scripts\TempDirs.txt) Do (
echo %%l%addtext% >> c:\scripts\TempDirs2.txt
)
@echo off
if "%1" NEQ "" goto :checkfile
echo Usage: c:\scripts\TempDirs2.txt
echo.
goto :eof
:checkfile
if exist %1 goto :DoDelTree
echo Input file does not exist
echo.
goto :eof
:DoDelTree
for /f "tokens=*" %%I in (%1) do deltree /Y %%I
goto :eof
:EOF
Echo Done!
My Computer
- Computer Manufacturer/Model Number
- Home Built
- OS
- Win 7 Ultimate x64 & x86
- CPU
- AMD Anthalon 64 XT 6000+ 3.0Ghz
- Motherboard
- Asus M2N-eE
- Memory
- 4 GB
- Graphics Card(s)
- Nvidia GeForce 8500 GT