-
I have CygWin installed, here is a batch file I use to run FG and backup to a RAID NAS (which is also backed to cloud storage) after each session:
Code:
set PATH=C:\cygwin64\bin;%PATH%
"C:\Program Files (x86)\Fantasy Grounds\FantasyGrounds.exe"
rem do a backup
bash ~/bin/backup_games
And my "backup_games" script:
Code:
#!/usr/bin/env bash
# vi:sw=2:ai
indir=/cygdrive/d/Fantasy\ Grounds/
outdir=linux:/mnt/public/games-backup/
rsync -Ca --delete-after --human-readable \
--info=BACKUP,COPY,DEL,NAME,STATS \
"$indir" "$outdir"
-
Ok.... ok....
Download this: https://www.7-zip.org/a/7za920.zip
and place the 7za.exe file in your c:\widows\system32 directory
Assuming your FG data file is in the (new) default location %AppData%\"fantasy grounds"
(The previous default location was %ProgramData%\"fantasy grounds")
And your OneDrive data file is in the default location %userprofile%\OneDrive
or your DropBox data is in the default location %userprofile%\dropbox
You can create a batch file like below... my compressed campaigns folder (after cleanup) is still over 200mb so work out what works for you...
Edit: Ive updated these... the initial error checking had some logic flaws so I removed them. Ive also changed it to backup all the XML files in the campaigns folder every time it runs and then to a separate file it will only add any changed data to the full campaigns backup (eg it will just update the existing zip file with new images/data). This only backups up \campaigns and no other folders.
This version will be much easier on your upload bandwidth after the first one syncs.
OneDrive
Code:
echo off
:BACKUP
:GETTIME
echo "GETTIME"
set hh=%time:~0,2%
if "%time:~0,1%"==" " set hh=0%hh:~1,1%
set dt=%date:~7,2%%date:~4,2%%date:~10,4%%hh%
echo %dt%
:BACKUPTARGET
echo "BACKUPTARGET"
echo %userprofile%\OneDrive\
if not exist %userprofile%\OneDrive\FGData mkdir %userprofile%\OneDrive\FGData
:BACKUPXMLFILES
echo "BACKUPXMLFILES"
echo %dt%
echo %ProgramData%\"fantasy grounds"\campaigns\
7za.exe a -tzip %userprofile%\OneDrive\FGData\%dt%.zip %AppData%\"fantasy grounds"\campaigns\*.xml -r
:BACKUPCAMPAIGNFILES
echo "BACKUPCAMPAIGNFILES"
if not exist %userprofile%\OneDrive\FGData\campaigns.zip 7za.exe a -tzip %userprofile%\OneDrive\FGData\%dt%.zip %AppData%\"fantasy grounds"\campaigns\*.xml -r
7za.exe u -tzip %userprofile%\OneDrive\FGData\campaigns.zip %AppData%\"fantasy grounds"\campaigns\*.* -r
:LISTFILES
echo "LISTFILES"
dir %userprofile%\OneDrive\FGData\
echo "Always double check that the backups have indeed worked!"
echo "Happy Gaming"
pause
EXIT
DropBox
Code:
echo off
:BACKUP
:GETTIME
echo "GETTIME"
set hh=%time:~0,2%
if "%time:~0,1%"==" " set hh=0%hh:~1,1%
set dt=%date:~7,2%%date:~4,2%%date:~10,4%%hh%
echo %dt%
:BACKUPTARGET
echo "BACKUPTARGET"
echo %userprofile%\DropBox\
if not exist %userprofile%\DropBox\FGData mkdir %userprofile%\DropBox\FGData
:BACKUPXMLFILES
echo "BACKUPXMLFILES"
echo %dt%
echo %appdata%\"fantasy grounds"\campaigns\
7za.exe a -tzip %userprofile%\DropBox\FGData\%dt%.zip %AppData%\"fantasy grounds"\campaigns\*.xml -r
:BACKUPCAMPAIGNFILES
echo "BACKUPCAMPAIGNFILES"
if not exist %userprofile%\DropBox\FGData\campaigns.zip 7za.exe a -tzip %userprofile%\DropBox\FGData\%dt%.zip %AppData%\"fantasy grounds"\campaigns\*.xml -r
7za.exe u -tzip %userprofile%\DropBox\FGData\campaigns.zip %AppData%\"fantasy grounds"\campaigns\*.* -r
:LISTFILES
echo "LISTFILES"
dir %userprofile%\DropBox\FGData\
echo "Always double check that the backups have indeed worked!"
echo "Happy Gaming"
pause
EXIT
-
Wanted to thank you guys! I tried this out and it does exactly what I need, except for one thing : I have to remember to think about clicking that batch file. If not, I'll let it slip. If only there was a way I could somehow attach a nag screen when FG closes-- then I'll back up for good luck.
-
Change the icon for FG to point to the batch file rather than the executable. This way, when you double click the icon, it runs the batch file.
-
You can also setup a scheduled task to run at logoff that runs the backup portion of the batch file. That way, every time you log off your computer, it will run your backup script first. (Though I'm not sure the dropbox or Onedrive backup would be completed before logoff, but then that would happen when you next log in.)
-
I created a batch file that runs (using the windows timer) at a time when Fantasy Grounds is never up, it backs up my FG directory to Dropbox.
-
Edit: Ive updated my post above... the initial error checking had some logic flaws so I removed them. Ive also changed it to backup all the XML files in the campaigns folder every time it runs and then to a separate file it will only add any changed data to the full campaigns backup (eg it will just update the existing zip file with new images/data). This only backups up \campaigns and no other folders.
-
*BUMP* Thanks for this @damned and everyone else. Great best practices method, "Thou shall backup!"
-
Thanks from me too, Dropbox script works well. Only thing is and this might just be me, but I do not have an %Appdata% Fantasy Grounds folder on my Windows 10 Pro 64 bit laptop so I set it to backup ProgramData\Fantasy Grounds instead. Think this is right :)
-
Well, that won't backup your campaign data... Check your settings to see where your data is stored.