Front Office Football Central  

Go Back   Front Office Football Central > Front Office Football Multiplayer > FOF MP Commish Resources
Register FAQ Members List Calendar Mark Forums Read Statistics

Reply
 
Thread Tools
Old 07-28-2014, 11:49 AM   #1
aston217
College Prospect
 
Join Date: Sep 2010
Batch file for backing up leagues

Here's the code I use to back up leagues. There are two versions, one for leagues I commish, one for leagues I don't. The example code I use here uses OSFL for the league name. The directory where you choose to backup to, of course, is entirely up to you. In this example it is C:\mybackupfolder\OSFL\ -- replace with whatever you like.

The batch file (as well as the VBS script file) must be placed in the %APPDATA%\Solecismic Software\Front Office Football Seven\ directory. You may create a shortcut to the batch file wherever you like.

2015-04-29 rev: make use of FOF7 import/export folders. Much better this way.

backup.bat (commish)

Run this AFTER saving & exporting the stage file. Otherwise, your "export" folder may not contain the save files.

Code:
@echo off for /f "tokens=1,2,3,5,6 usebackq delims=:/ " %%a in ('%date% %time%') do set TimeStamp=%%c-%%a-%%b_%%d%%e echo %TimeStamp% md "C:\mybackupfolder\OSFL\New" copy export\OSFL2007\* "C:\mybackupfolder\OSFL\New" md "C:\mybackupfolder\OSFL\New\imports" copy import\OSFL2007\* "C:\mybackupfolder\OSFL\New\imports" CScript zip.vbs "C:\mybackupfolder\OSFL\New" "C:\mybackupfolder\OSFL\New.zip" cd "C:\mybackupfolder\OSFL" rename New.zip "%TimeStamp%.zip" rd /q/s New

Note that the timestamp code is region-specific (I'm in the US). I just put in the first thing that I found worked for me. You'll likely have to do a little headachey googling if it doesn't produce the right timestamp for you.

zip.vbs
To perform the zipping, I use this code which I found online. It is Windows specific. You can easily rewrite the batch file without zipping if you like; just name the folder "%TimeStamp%" to begin with rather than "New". The current way creates the "New" folder, copies everything over, zips it up, and then deletes the "New" folder.

Code:
'Get command-line arguments. Set objArgs = WScript.Arguments InputFolder = objArgs(0) ZipFile = objArgs(1) 'Create empty ZIP file. CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar) Set objShell = CreateObject("Shell.Application") Set source = objShell.NameSpace(InputFolder).Items objShell.NameSpace(ZipFile).CopyHere(source) 'Required! wScript.Sleep 8000

backup.bat (GM version)

Run this AFTER importing a new stage file. It will also backup your previous export (i.e, your export for the stage file you are currently backing up).

Code:
@echo off for /f "tokens=1,2,3,5,6 usebackq delims=:/ " %%a in ('%date% %time%') do set TimeStamp=%%c-%%a-%%b_%%d%%e echo %TimeStamp% md "C:\mybackupfolder\OSFL\New" copy import\OSFL2007\* "C:\mybackupfolder\OSFL\New" md "C:\mybackupfolder\OSFL\New\export" copy export\OSFL2007\* "C:\mybackupfolder\OSFL\New\export" CScript zip.vbs "C:\mybackupfolder\OSFL\New" "C:\mybackupfolder\OSFL\New.zip" cd "C:\mybackupfolder\OSFL" rename New.zip "%TimeStamp%.zip" rd /q/s New

Use at your own risk!
__________________
OSFL (join us!) CFL
Float likeabutterflysting likeabee.




Last edited by aston217 : 05-14-2015 at 12:00 PM.
aston217 is offline   Reply With Quote
Old 04-29-2015, 12:14 PM   #2
aston217
College Prospect
 
Join Date: Sep 2010
Updated to make direct use of FOF7's import and export folders to grab the necessary files.
__________________
OSFL (join us!) CFL
Float likeabutterflysting likeabee.


aston217 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump


All times are GMT -5. The time now is 02:44 PM.



Powered by vBulletin Version 3.6.0
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.