Highlighted
chrygel
2 Iron

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

Tags (3)
0 Kudos
2 Replies
ble1
6 Indium

Re: how to use savepnpc pstcmd to delete successfully backed up files

Make a script which does list of files to be backed up and call it with save -I.  If rc=0 remove files.

0 Kudos
crazyrov
4 Tellurium

Re: how to use savepnpc pstcmd to delete successfully backed up files

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"

)

-------------------------------------------------------------------------------------------------------------------

0 Kudos