Home Page list
Backup Media with Database - 7Zip #batch #backup #media #7zip
Not everyone wants to pay for an archive utility as much or more than the price of RootsMagic alone, especially when RootsMagic already includes an archiving engine that, with a few tweaks, could do the job. So here is a full database + media procedure that uses a free backup program, 7-Zip
AND produces a .rmgb archive/backup file containing both a RootsMagic database and the media files it uses. And the really good news is that the RootsMagic Restore function will unpack the archive to a folder where the media will be in the same relative folders as they were in at the time of archiving. If this target folder path is different from the path of the original database folder, all that's needed to correct the now erroneous media links in the database is to use RM's Search & Replace on Multimedia filenames. So c'mon RM! It should be a trivial task to add a full backup feature to the File menu...
If you have not done so, read the original page Backup Media with Database - RAR
to find out about setting up the shortcut and placement of files.
This is the batch procedure to be called by the shortcut:
(.bat added due some systems' security. Remove after d/l.)
Here is the script:
REM RMfullbackup.bat by Tom Holden 2011-02-02
REM Rev 2011-03-20: uses free 7-Zip utility to create a .rmgb backup compatible with RootsMagic Restore function
REM Backs up a RootsMagic database file and all the media files referenced by it to one, compressed ZIP type file.
REM Command syntax: RMfullbackup.bat <databasename>
REM This batch file should be in the same folder as the database and expects a Backups folder immediately below it.
REM All media files must be in subsidiary folders below the database folder or in the same folder. If not, then
REM the SET variables must be revised so that the contentPath is common to the database and media paths.
REM Close the database file from RootsMagic before running.
REM The first backup can take considerable time, depending on the total of the file sizes.
REM To save time on subsequent backups, RMfullbackup merely updates the backup file for those files added, changed or deleted.
REM Install the SQLite3 command line version in the same directory as the RMGC database file(s)
REM OR set a system PATH to where sqlite3.exe is located
REM OR prepend the path to sqlite3.exe in the command below.
REM Likewise for 7z.exe
REM Under the RM Data folder, create a folder Backups; if a different path is to be used, edit the command line below.
REM The backup file will be written to the Backups folder and will have the name <databasename>_fullbackup.rmgb
REM A log will also be written to the Backups folder with the name <databasename>_fullback.rmgb.log
REM ***set variables
SET archiver=C:\Program Files\7-Zip\7z.exe
REM ***run sqlite query to get list of media files to be backed up
sqlite3.exe %1.rmgc "SELECT DISTINCT trim(MediaFile) from MultiMediaTable;" > "%list%"
REM ***change directory to the root path common to both the database and media files.
cd /d "%contentPath%"
REM backup media files listed by query followed by the database file
"%archiver%" u -tzip "%archive%" @"%list%" %1.rmgc -r > "%archive%.log"