Unsolved
This post is more than 5 years old
44 Posts
0
1158
how to use savepnpc pstcmd to delete successfully backed up files
Hi Experts,
we'd like to remove the contents of a certain directory after the backup completes successfully. The idea is to use savepnpc and run a postcmd script to check if the saveset has been successfully saved and in response remove its content. The check is performed using mminfo.
But when the pstcmd starts the index is not yet available from the mminfo command! After a while the mminfo command will show the content of the backup, but not when the pstcmd kicks in.
Is this the normal behaviour?
Has anybody done something similar and can share the experience with me?
Many thanks
Christian
ble1
2 Intern
2 Intern
•
14.3K Posts
0
January 15th, 2014 11:00
Make a script which does list of files to be backed up and call it with save -I. If rc=0 remove files.
crazyrov
4 Operator
4 Operator
•
1.3K Posts
0
January 15th, 2014 23:00
I had done this earlier for one my customer running vRanger backups. We would backup the snapshot to tape then delete it from the disk on successful completion. You can put this in the pre-command. The script would make a list of the files/folders to be backed up and would delete it on successful completion of backups.. Here it is
DISCLAIMER : Use at you own risk, it worked for me but not sure how your set up is
-------------------------------------------------------------------------------------------------------------------
@echo OFF
set ROOT=S:\RANGER
dir /b %ROOT% > list1.txt
for /f "delims==" %%I in (list1.txt) do (
save -w month -y month -b "Ranger Daily" "%ROOT%\%%I"
if "%errorlevel%" == "0" rmdir /s /q "%ROOT%\%%I"
)
-------------------------------------------------------------------------------------------------------------------