Help!
Code: Select all
@Echo Off
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
:: Local Variables
Set "Log=%Temp%\%xxStore%-SecDel-%dYYMMDD%-%tHHMMSS%.csv"
Set "LookUpSet= *File1* *.zip *File2*"
Set "Exceptions=Lexmark Java Code128 Drivers Oracle SysMgt OfficeScan"
Set "SkipPath=N"
:: Process From the Root!
cd \
:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
:: Main Job
:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
CLS
Echo =========================
Echo Begin: Looking for Files
Echo ** Please be Patient! **
Echo =========================
Call :LogMsg B "Looking for Cash Files"
For /F "Delims=" %%F In ('Dir /B/S %LookUpSet%') Do (
Set "f=%%~nxF"
Set "p=%%~pF"
Set "s=%%~zF"
Cls
Echo;
Echo =======================
Echo Looking Through Files
Echo =======================
Echo;
Echo Path: !p!
Echo File: !f! : !s!
Echo;
Call :RemoveFile
If /I [!SkipPath!] EQU [N] (
Find "!p!" %PurgeFolders% >NUL
If Not ErrorLevel 1 (Echo !p! >> %PurgeFolders%)
)
Pause
)
Echo;
Echo ================================
Echo Finished Looking Through Files
Echo ================================
Call :LogMsg E "Looking for Cash Files"
Call :LogMsg E "Job Finished"
:Exit
Echo ... Job Finished!
Goto:EOF
EndLocal
:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
:: File Removal
:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
:RemoveFile
Call :ExceptPath
If [!SkipPath!] EQU [N] (
CD /D !p!
Echo --Removing File: !f!
Echo ** SDelete -p 5 !f! **
)
Goto:EOF
:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
:: See if we need to skip this path deletion
:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
:ExceptPath
:: Check for an exception ID
For /D %%E in (%Exceptions%) Do (
Set "SkipPath=N"
Echo !p! | Find "%%E" >NUL
If Not ErrorLevel 1 (Set "SkipPath=Y")
)
Goto:EOF