Welcome

# Details on pre- and post-backup commands

acheong87 :

May 02, 2014

I didn't see any threads revealing details about the pre- and post-backup commands...

1. Are any variables exposed? The following would be helpful, I think:

%bvckup2_from%
%bvckup2_to%

2. Would it be possible to log the output of the pre- and post-backup commands? I wrote a rather complex one-liner today, and though it works from my CLI, it doesn't appear to do anything when run from bvckup2. The logs indicate that it completed successfully, but don't say much more, so it's a bit perplexing to debug. (I wonder, do you perhaps disallow the invocation of a sub-shell cmd.exe? I need to invoke cmd.exe with option /v for delayed expansion for the following to work.)

cmd /v /c "set source=C:\source& set target=C:\target& set archive="C:\target\$Archive of Deleted Items (Bvckup)"& set today=%DATE:/=-%& set today=!today:~4,5!& set today=%DATE:~-4%-!today!& set now=%TIME: =0%& set now=!now::=-!& set now=!now:~0,8!& robocopy.exe !source! !target! /l /e /zb /xx /xl /fp /ns /nc /ndl /np /njh /njs | sed -e s/^^[\t\x20]\+// | sed -e /^^$/d | sed -e s/^!source:\=\\!// | sed -e s/$$.*$$$$\..\+$$$/\/vkrhyz\n\x22!source:\=\\!\1\2\x22\n\x22!archive:\=\\!\1\x20(replaced\x20on\x20!today!\x20at\x20!now!)\2*\x22/" | xargs -l3 xcopy" 3. Such a minor detail I feel bad even pointing it out: In the GUI, when you drill down to see the command under "Running external pre[post]-backup command ..." it appears that ampersands (&) are stripped out. They do appear in the actual log file though, so no worries. 4. Any and all information you might have on pre/post-backup commands would be much appreciated! Even if they're just unprocessed, incomplete, even incorrect development notes :-) -- In case you're curious, the above implements versioned backups. It uses a dry run of robocopy.exe to detect changed files, then GnuWin32 ports of sed and xargs to put together and execute a chain of xcopy commands, e.g. xcopy /vkrhyz "C:\source\test.txt" "C:\target\$Archive of Deleted Items (Bvckup)\test (replaced on 2014-05-02 at 03-51-57).txt*"
xcopy /vkrhyz "C:\source\filename with spaces.txt" "C:\target\$Archive of Deleted Items (Bvckup)\filename with spaces (replaced on 2014-05-02 at 03-51-57).txt*" xcopy /vkrhyz "C:\source\foo\bar\baz.txt" "C:\target\$Archive of Deleted Items (Bvckup)\foo\bar\baz (replaced on 2014-05-02 at 03-51-57).txt*"

I did see the other thread regarding versioned backups, and I love that you're researching it so thoroughly and committing to an open format. Keep it up!

(Personally though, I think I'll always prefer simplicity and peace of mind over space-savings. It may seem inefficient and redundant to have so many full copies of files, but they're right there for me to see, in familiar form, openable without any tools so that I can verify and know that everything's in order. Diffs on the other hand don't have that same "feel," even if stored in open format. Of course I don't mean to knock your idea—I think most others would prefer an efficient storage format. But my use-case is for backing up personal files, 95% (by bytes) of which consist of photos, music, videos, and software, whose bytes never change and thus never get versioned. Plus many of the larger things that do get modified daily like bookmarks.html (~0.5MB) and my Evernote database (~8MB) also get stored in clouds, so I don't actually have to back them up every night. So for what little needs versioning on my personal system, I'm happy to pay the going rate of 20 cents per gigabyte and keep up with storage, while having simplicity :-)

acheong87 :

May 02, 2014

Oh, Christ. I checked every thread except the FAQ / Feature threads / Feature requests up top. I found the page with pre/post-backup information. Sorry! Let me look through that and play around and I'll post back here if I'm still having trouble.

acheong87 :

May 02, 2014

Okay, questions #1, #2, and #4 are answered. I see the "from" and "to" variables now, and I also see that I can run with cmd /v /k instead of cmd /v /c to see why my command's not running. (It can't seem to find sed, which must mean it's using a different \$PATH than my user.)

Question #3, I don't think anyone will notice the ampersands so just ignore me :-)

Alex Pankratov :

May 02, 2014

Personally though, I think I'll always prefer simplicity and peace of mind over space-savings.

True, same here, but I also have a VM image or two. And then all this deduplication witchcraft suddenly starts to make a lot of sense :)

ampersands (&) are stripped out.

Ah, good catch. That's DrawText() acting up. It treats them as an accelerator key markup.

acheong87 :

May 02, 2014

Ah, yeah, that makes a lot of sense (re: VMs).

Froggie :

Oct 21, 2017

Greetings!  In using a simple VBS shell to hide a .BAT command window, I notice that it runs w/error <CreateProcess() failed with 193> as a pre-backup command but errorless as an interactive command.

Are VBS scripts not allowed in this scenario?

Alex Pankratov :

Oct 21, 2017

You need to tell bvckup2 to launch your VBS script via _shell_ invocation rather than to try and spawn it as an executable.

EITHER

1. Prepend "start" to your command, e.g. "start abc.vbs" instead of just "abc.vbs"

OR

2. Change the following line as shown in settings.ini for the job:

conf.command_pre_type    2

See https://bvckup2.com/support/forum/topic/933 for how to change settings.ini correctly.

Froggie :

Oct 22, 2017

Thanks!

Create