Tidy windows user profile temp

asked 2017-08-04 10:58:04 -0600

benjosevilla gravatar image

I would like to use Tidy instead of my batch file to clean up the contents of the each of the Windows profile temp folder of the target node. Currently, I use a batch file that enumerates c:\users to list all the profile folders. For each profile, delete c:\users\%profile%\AppData\Local\Temp*.* I use the "forfiles" to only apply the deletion for files older than 7 days.

(Set Target=C:\Users) If EXIST "%Target%",( For /f "Tokens=" %% in ('dir "%Target%" /B') Do ( cd/D "%target%\%%\AppData\Local\Temp" && ( ATTRIB -S -H -R -A /D /S & ( For /f "Tokens=" %%* in ('dir /B') Do ( forfiles /s /d -7 /c "cmd /c if @isdir==FALSE del @file" )))) )

I would rather use native puppet tools like tidy.

edit retag flag offensive close merge delete