Answer» I created this batch file (XP Cleanup.bat) to faster automate deleting temporary files. I CURRENTLY have the batch file logging the user, start, and end time of when it ran. I would like to have a more detailed log file. For example how many files from each location were deleted and the time to do it. I am not SURE that this is even possible. I found that USING the command (dir "%userprofile%\COOKIES" /b/s /a-d |find /v /c "::" >> Cleanup.txt) would GIVE me the number of cookies/files in the “Cookies” folder. When I try to create a variable with the command (dir "%userprofile%\cookies" /b/s /a-d |find /v /c "::" ) it errors. Can anyone help me?
Thank you.
XP Cleanup.bat ECHO OFF
cd "c:\T1" echo %userprofile:~26% >> Cleanup.txt echo Start: %Date% %time% >> Cleanup.txt
title Deleting Cookies. . . cd "%userprofile%\Cookies" del *.* /F /S /Q /A: R /A: H /A: A cls
title Deleting Internet History. . .. . . cd "%userprofile%\Local Settings\History" del *.* /F /S /Q /A: R /A: H /A: A rmdir /s /q "%userprofile%\Local Settings\History\History.IE5" cls
title Deleting Local Temp Files. . . cd "%userprofile%\Local Settings\Temp" del *.* /F /S /Q /A: R /A: H /A: A rmdir /s /q "%userprofile%\Local Settings\Temp" cls
title Deleting Local Users Temporary Internet Files. . . cd "%userprofile%\Local Settings\Temporary Internet Files" del *.* /F /S /Q /A: R /A: H /A: A rmdir /s /q "%userprofile%\Local Settings\Temporary Internet Files\Content.IE5" cls
title Deleting Windows Temp Files. . . cd "C:\WINDOWS\Temp" del *.* /F /S /Q /A: R /A: H /A: A rmdir /s /q "C:\WINDOWS\Temp" cls
title Emptying Recycling Bin... rem must copy nircmd.exe to System32 folder to work nircmd.exe emptybin cls
cd "c:\T1" echo Finish: %Date% %time% >> Cleanup.txt echo. >> Cleanup.txt
EXIT
Cleanup.txt Default Start: Wed 05/02/2007 21:50:48.78 Finish: Wed 05/02/2007 21:50:48.88
Code: [Select]for /f %%i in ('dir "%userprofile%\cookies" /b/s /a-d ^| find /v /c "::" ') do ( echo %%i >> Cleanup.txt )
Thats got it.
Thank You!
|