BeerSmith Software > Tips

PINNED: Create a backup of your recipes

<< < (2/3) > >>

BeerSmith:
No,
  Unfortunately there is currently no way to adjust the data directory, other than to just install the program to a different location.  I do think it would make a nice addition for a future upgrade however.

Thanks,
Brad Smith

jrehmert:
I wrote a simple vbscript (below) that can be modified to backup the standard install location for beersmith at any point in time - it assumes that one has WinRAR installed in its standard location... Actually, I have another vbscript that I compiled into an exe and I use it to start beersmith, then create a backup just after I close it...

For this the srcFold is the standard install directory, but can be modified and the bakFold is the backup folder - for me Z:\ is mapped to my server which is uing RAID 5 and tape backups, so I have lotsa backups.

If some think this is overkill, it might be, but I'm not going to lose my recipes ever again!! (yup, I lost about a year's worth of recipes when my last laptop HDD kicked the bucket and, trust me, IT SUCKED AND STILL SUCKS!!!)

To use the script, copy the code below and paste it into a text file, then save the text file as <whatever you want>.vbs. Then, in order to run it, use cscript <file folder>\<whatever you named it>.vbs


--- Code: ---bakFold = "Z:\_BACKUPS"
srcFold = "C:\Progra~1\BeerSmith"

sYear = Year(Now())
sMonth = Month(Now())
sDay = Day(Now())
sHour = Hour(Now())
sMinute = Minute(Now())
sSecond = Second(Now())

Randomize()
rNum = Int(1000000 * Rnd())

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oDest = oFSO.GetFolder(bakFold)
Set oShell = CreateObject("WScript.Shell")

oShell.Run srcFold & "\BeerSmith.exe", 1, True

If oDest.Type = "File Folder" Then
oShell.Run "C:\Progra~1\WinRAR\rar.exe a -m5 -r -ta" & _
sYear & sMonth & sDay & sHour & sMinute & sSecond & " " & _
bakFold & "\BeerSmith_" & sYear & "-" & sMonth & "-" & _
sDay & "_" & rNum & ".rar " & srcFold, 1, True
'WScript.Echo "C:\Progra~1\WinRAR\rar.exe a -m5 -r -ta" & _
' sYear & sMonth & sDay & sHour & sMinute & sSecond & " " & _
' bakFold & "\BeerSmith_" & sYear & "-" & sMonth & "-" & _
' sDay & "_" & rNum & ".rar " & srcFold
End If

Set oShell = Nothing
Set oDest = Nothing
Set oFSO = Nothing

--- End code ---

Fingers:
This procedure doesn't seem to be working for me. I get 'An unknown error has occurred while accessing E:\recipes.bsm' when I try to import the file back into Beersmith.

I had backed up the recipe.bsm file right out of the folder and it was over 3.6G. When I first did the export command The file I got was under 400K. The next time I did it it was 1.3M. My E:\ drive is a flash drive. I can import the file I saved manually no problem.

I'm set properly to 'My Recipes' and I select 'Export As' under the file menu, ensure 'All items in the current view' is selected and then just save it as the default recipes.bsm to my flash drive.

I'm running Windows XP home with service pack 3.

Any ideas? I don't think it's a big problem because I can do my backup manually, but I'm afraid that if I don't follow your directions there may be something missing if I have to use it to restore my files. I have a lot of recipes stored.

BeerSmith:
Hi,
  Copying the file "recipes.bsm" from the BeerSmith directory will work just fine as well.  In fact if you want to be safe just make a backup of the whole BeerSmith directory periodically.

  I don't know why the export would not work, but 3.6 GB is a huge file.  I would recommend considering breaking it into smaller files as you are probably running into 32 bit limitations (BeerSmith is a 32 bit windows app and has a limited file size of around 2GB addressable I think).

  You do need to be careful under Vista, since the recipe files are actually stored in a "compatability" directory if you are not running as an administrator.  Go to the BeerSmith directory and you will see the "compatability" icon on the toolbar.

Cheers,
Brad

jrehmert:
Here's a little VBScript I created that starts BeerSmith (currently set for BeerSmith 2, but could easily be modified for v1), then backs up all bsmx files to a folder in the default dropbox location.  I put the VBScript in the root of my Dropbox and then created a shortcut on my desktop that executes C:\Windows\System32\wscript.exe //nologo //B c:\users\<my username>\my documents\my dropbox\runbeersmith.vbs" and it works like a charm.  The script is documented inline, so anyone can open/modify as needed using a standard text editor.  Here's the code (I'm sure not the best, most efficient code, but it does what I need):

--- Code: ---' RUNS BEERSMITH AND BACKS UP BSMX FILES AFTER CLOSED

Set oShell = CreateObject("WScript.Shell")
' LOCATION OF BEERSMITH EXECUTABLE - USING SHORT FILES AVOIDS DOUBLE QUOTE NIGHTMARES
oShell.Run "C:\Progra~2\BeerSmith2\BeerSmith2.exe", 1, True

' GETS USERNAME TO USE IN DROPBOX LOCATION (DEFAULT)
set oNet = CreateObject("WScript.Network")
oUser = oNet.UserName

' GETS DATE AND TIME FOR USE IN BACKUP FILE NAME AND LOGFILE
sNow = Now()
sYear = Year(sNow)
sMonth = twoDigits(Month(sNow))
sDay = twoDigits(Day(sNow))
sHour = twoDigits(Hour(sNow))
sMinute = twoDigits(Minute(sNow))
sSecond = twoDigits(Second(sNow))

' FOLDER WHERE BEERSMITH IS INSTALLED
srcFolder = "C:\Progra~2\BeerSmith2"
' FILE EXTENSION(S) TO BACKUP
srcFiles = "*.bsmx"
' LOCATION OF 7-ZIP (DEFAULT)
zipExe = "C:\Progra~1\7-Zip\7z.exe"
' OPTIONS TO PASS TO 7-ZIP TO CREATE A ZIP FILE (MOST PORTABLE)
zipOptions = " a -tzip "
' FOLDER TO SAVE ZIP FILE
zipFolder = "C:\Users\" & oUser & "\Documents\MyDrop~1\BeerSmithBak"
' FILE NAME FOR ZIP FILE
zipFile = "BeerSmith2_" & sYear & sMonth & sDay & "-" & sHour & sMinute & sSecond & ".zip "
' LOG FILE NAME
logFile = "_log.txt"

Set oFSO = CreateObject("Scripting.FileSystemObject")

' IF BACKUP FOLDER (zipFolder) DOES NOT EXIST, THEN CREATE IT
If Not oFSO.FolderExists(zipFolder) Then
  set oDest = oFSO.CreateFolder(zipFolder)
End If

' SET THE DESTINATION FOLDER TO zipFolder VARIABLE
Set oDest = oFSO.GetFolder(zipFolder)

' DESTINATION SHOULD BE A FOLDER BASED ON ABOVE, BUT JUST FOR GIGGLES, MAKE SURE THE DESTINATION IS A FOLDER
If oDest.Type = "File folder" Then
  ' CREATE OR OPEN THE LOG FILE FOR APPENDING
  Set oWrite = oFSO.OpenTextFile(zipFolder & "\" & logFile, 8, True)
  ' CREATE THE ZIP FILE
  Set oExec = oShell.Exec(zipExe & zipOptions & zipFolder & "\" & zipFile & srcFolder & "\" & srcFiles)
  ' WRITE THE FOLLOWING LINES TO THE LOG FILE FOR READABILITY/REFERENCE
  oWrite.WriteLine "******************************"
  oWrite.WriteLine sMonth & "/" & sDay & "/" & sYear & " " & sHour & ":" & sMinute & ":" & sSecond
  oWrite.WriteLine "******************************"
  oWrite.Write oExec.StdOut.ReadAll
  oWrite.WriteBlankLines(1)
  oWrite.WriteLine "******************************"
  oWrite.WriteBlankLines(4)
End If

' CLOSE NICELY
Set oShell = Nothing
Set oDest = Nothing
Set oFSO = Nothing

' MAKE SURE THERE ARE TWO DIGITS IN THE MONTH, DAY, HOUR, MINUTE & SECONDS VARIABLES TO MAKE SORTING WORK RIGHT
Function twoDigits(iInput)
If iInput < 10 Then
twoDigits = "0" & iInput
Else
twoDigits = iInput
End If
End Function

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version