The support forum

how to Post-backup delete the source?

Oneyedrunk :

Jul 10, 2019

Hi everyone,
I don't know much about coding, can someone help me with this?
It would be appreciated.

I'm looking to delete the contents of the source folder after a successful backup run with no errors.
It's a simple backup from A to B that doesn't delete anything on the destination.
Obviously I wouldn't want it to delete anything if there is an error of any kind.

Thanks in advance,
Daniel.

Oneyedrunk :

Jul 10, 2019

Update: Oh I figured it might be better if it would Recycle the contents of folder instead of deleting. If that would be possible.
Thanks!

Oneyedrunk :

Jul 10, 2019

UPDATE: Have managed to do it with some research and trial and error.
Just made a batch file with
recycle "C:\XYZ\*"

The only issue is I don't know what would happen if there was an error performing the backup. I wouldn't want it to recycle anything that wasn't backed up properly.
Any ideas?

Thanks!

Alex Pankratov :

Jul 10, 2019



This is done by making a short .bat file like this:

        if NOT "%BVCKUP_status%" == "Completed" exit
        if NOT "%BVCKUP_errors%" == "0" exit
        recycle "%BVCKUP_src%\*"

That is, put these lines in a text file, save, for example, as C:\Temp\recycle-if-ok.bat and then set post-backup command to

        C:\Temp\recycle-if-ok.bat

These "BVCKUP_..." variables are set up by bvckup2 when it starts pre/post-backup scripts. They capture a lot of different details about the backup and the program in general. There's over 80 of them.

They can be inspected by a batch file (just like it's done above) and this can be used to do certain things selectively.

New topic

Create
Made by IO Bureau in Switzerland
Support

Updates
Blog / RSS
Follow Twitter
Reddit
Miscellanea Press kit
Testimonials
Company Imprint

Legal Terms
Privacy