forfiles /p "e:" /d -10 /m DailyBackup.tib /c "cmd /c Ren @path DailyBackup.Old.tib"
forfiles /p "e:" /d -20 /m *.tib /c "cmd /c del @path"
@ECHO OFF
SETLOCAL
SETLOCAL ENABLEDELAYEDEXPANSION
SET count=0
for %%o IN (e:\*.tib) DO (
echo %%o
SET /A count=count + 1
)
set count=000%count%X
set count=%count:~-3%
echo %count%
IF "%count%" LSS "10X" (C:\Scripts\SMTPSend.exe h=smtp.yourISPserver.net s=BackupMonitoronExchange@your-company.ca r=cliffz@your-company.ca t="Numbers of backed up files are less than 10 files." b="Please check Acronis Backup on Exchange server!") ELSE echo No Issue!
ENDLOCAL ENABLEDELAYEDEXPANSION
ENDLOCAL
@echo off
SETLOCAL
SETLOCAL ENABLEDELAYEDEXPANSION
SET destinationfolder=g:\Arcronis Backup Vault
SET olderthanday=215
::Delete files older than ## days.
forfiles /p "%destinationfolder%" /d -%olderthanday% /m *.tib /c "cmd /c del @path"
forfiles /p "%destinationfolder%" /m *.* /c "cmd /c set /a count+=1" | find "1" > "%temp%\count.log"
forfiles /p "%destinationfolder%" /d -2 /m *.* /c "cmd /c set /a count2days+=1" | find "1" > "%temp%"\count2days.log"
set /p count=<"%temp%\count.log"
set /p count2days=<"%temp%"\count2days.log"
IF "%count%" EQU "%count2days%" (C:\Scripts\SMTPSend.exe h=smtp.telus.net s=BackupMonitoronFNES@yourcompany.ca r=cliffz@yourcompany.ca t="No new backup file in 2 days" b="Please check Acronis Backup on FNES Exchange server!") ELSE echo No Issue!)
echo %count% v.s. %count2days%
::
ENDLOCAL ENABLEDELAYEDEXPANSION
ENDLOCAL