BATCH, to delete and save one log

BATCH, to delete and save one log.

  • batch logs of the files deleted

    Votes: 0 0.0%
  • batch with the size of the removed files

    Votes: 0 0.0%

  • Total voters
    0

CeesarSol

TS Rookie
Hi All,

I am trying to do one batch to delete all the temporary files in the machine and save one log of the space removed and/or the removed files.

Now I have the steps to remove the temporal files


==
@Echo off

IF EXIST c:\windows\temp\ del /f /s /q c:\windows\temp\
IF EXIST c:\windows\tmp\ del /f /s /q c:\windows\tmp\
IF EXIST C:\tmp del /f /q C:\tmp\*.*
IF EXIST C:\temp del /f /q C:\temp\*.*
DEL /f /s /q %temp%\
DEL /f /s /q %tmp%\

IF EXIST "C:\Users\" (
for /D %%x in ("C:\Users\*") do (
rmdir /s /q "%%x\AppData\Local\Temp"
mkdir "%%x\AppData\Local\Temp"
)
)

IF EXIST "C:\Users\" (
for /D %%x in ("C:\Users\*") do (
rmdir /s /q "%%x\AppData\Local\Microsoft\Windows\Temporary Internet Files"
mkdir "%%x\AppData\Local\Microsoft\Windows\Temporary Internet Files"
)
)
@Echo off
==

any one could help me in how I could save the log ?