Scripting noob here! I found this script that would help our environment out with clearing a folder under the user when they log on. I want put run this with a logon.gpo. only difference is I don’t want to keep the source folder.I don’t fully understand how to put in the path of the folder for this script:
http://community.spiceworks.com/how_to/show/792-delete-all-files-and-subfolders-easy-batch-script
Path: C:\Users%username%\cpsi
Folder to remove= cpsi
echo off
REM Edit your folder path
set CAT=d:\temp
dir "%%CAT%%"/s/b/a | sort /r >> %TEMP%\files2del.txt
for /f "delims=;" %%D in (%TEMP%\files2del.txt) do (del /q "%%D" & rd "%%D")
del /q %TEMP%\files2del.txt
Here is how I would do it:
echo off
REM Edit C:\Users%username%\cpsi
set CAT= C:\Users%username%\cpsi
dir “%%CAT%%”/s/b/a | sort /r >> %TEMP%\files2del.txt
for /f “delims=;” %%D in (%TEMP%\files2del.txt) do (del /q “%%D” & rd “%%D”)
del /q %TEMP%\files2del.txt
???
2 Spice ups
rd "C:\Users\%username%\cpsi" /s /q
Would this one-liner work?
3 Spice ups
I will surly give it a try 