The script below allows me to delete files older than 90 days located on REMOTE PC, but I want to EXEMPT certain folder such as WindowsHelp, PUBLIC, Default.
Here is my script
echo Enter Workstation Names, then "Ctrl + Z" and then "Enter".
TYPE con >> Users.txt
timeout /t -1
echo Deleting Everything in "User's Folder" Older than 90 Days
For /F %%A in (Users.txt) do PushD "\\%%A\C$\Users\" &&("forfiles.exe" /s /m "*.*" /d -90 /c "cmd /c del /a:a /q /f @file") & PopD
Here is an example of what I want to incorporate into this "https://stackoverflow.com/questions/57108602/batch-delete-all-files-and-directories-except-specified-file-and-directory"
@ECHO OFF
SETLOCAL
SET "sourcedir=U:\sourcedir"
SET "keepfile=1.bat"
SET "keepdir=keep me"
FOR /d %%a IN ("%sourcedir%\*") DO IF /i NOT "%%~nxa"=="%keepdir%" RD /S /Q "%%a"
FOR %%a IN ("%sourcedir%\*") DO IF /i NOT "%%~nxa"=="%keepfile%" DEL "%%a"
GOTO :EOF
Can someone assist me on how I would be able to do this please? Thanks in advance!