Hi All,
Here's the script you can run in windows for file retention. For this, we need "7z" module to be installed in windows.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ECHO @OFF
C:
CD\
set S1_WAL_FILES="E:\Wal_Archive_Sms1"
set S2_WAL_FILES="E:\S1_Share\Wal_Archive_Sms2"
REM SMS1 Wal files Backup
forfiles /p %S1% /m * -d -4 -c "cmd /c 7z a -t7z E:\Wal_Backup\Wal_Archive_S1_BKP_%date:~-10,2%_%date:~-7,2%_%date:~-4,4%.7z \"@fname\"" >null
REM SMS2 Wal files Backup
forfiles /p %S2_WAL_FILES% /m * -d -4 -c "cmd /c 7z a -t7z E:\Wal_Backup\Wal_Archive_S2_BKP_%date:~-10,2%_%date:~-7,2%_%date:~-4,4%.7z \"@fname\"" >null
REM SMS1 WAL Retention
forfiles /p %S2_WAL_FILES% /m * -d -4 -c "cmd /c del \"@fname"\"
REM SMS2 WAL Retention
forfiles /p %S2_WAL_FILES% /m * -d -4 -c "cmd /c del \"@fname"\"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--Dinesh
Here's the script you can run in windows for file retention. For this, we need "7z" module to be installed in windows.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ECHO @OFF
C:
CD\
set S1_WAL_FILES="E:\Wal_Archive_Sms1"
set S2_WAL_FILES="E:\S1_Share\Wal_Archive_Sms2"
REM SMS1 Wal files Backup
forfiles /p %S1% /m * -d -4 -c "cmd /c 7z a -t7z E:\Wal_Backup\Wal_Archive_S1_BKP_%date:~-10,2%_%date:~-7,2%_%date:~-4,4%.7z \"@fname\"" >null
REM SMS2 Wal files Backup
forfiles /p %S2_WAL_FILES% /m * -d -4 -c "cmd /c 7z a -t7z E:\Wal_Backup\Wal_Archive_S2_BKP_%date:~-10,2%_%date:~-7,2%_%date:~-4,4%.7z \"@fname\"" >null
REM SMS1 WAL Retention
forfiles /p %S2_WAL_FILES% /m * -d -4 -c "cmd /c del \"@fname"\"
REM SMS2 WAL Retention
forfiles /p %S2_WAL_FILES% /m * -d -4 -c "cmd /c del \"@fname"\"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--Dinesh
Comments
Post a Comment