re: MapMate snapshots
Sorry for the delay in reply. I never noticed your post from the 18/06. To make up for the delay I have created a modified version of the script we use to cater for a different scenario.
Scenario A - You have access to a corporately managed shared drive and somebody else is responsible for managing snapshots / backups. This is our scenario as we are hosted by a local authority. The local authority has a data centre team that back up to tape nightly and weekly. So all we have to do is get our data onto the shared drive. We can ask the data centre guys for snapshots to be restored from various times if need be.
i) create a blank text file called mapmate_bak.bat (or whatever you want as long as the ext is .bat). right click on the file and select Edit (this should open notepad)
ii) copy and paste the line of text below
xcopy "C:\Users\paul.barrington\Documents\My MapMate\*.*" "S:\LRC\MapMate\_GMLRC Mapmate Backups\9kk\" /s /r /d /y /i
iii) change the source and destination file paths as appropriate for you. remember to leave the trailing \s and *.* from the source as in the example above
/s includes subdirectories in the copy
/r includes read-only files
/d makes the copy more efficient by ignoring files that have not changed since the last time the script ran
/y automatically overwrites existing destination files
/d where the destination directory does not exist yet cmd will create a new directory without prompting for manual input re: file or directory
iv) save changes and close notepad. double click on the .bat file to run it or add it to the windows scheduler to run every n days / weeks. we run ours every day at startup using the scheduler
* * * * * * * * * * * * *
Scenario B - You don't have the luxury of a data centre team / shared drive and you are responsible for your own snapshots. When this version of the script runs it retains previous snapshots allowing you to manually roll-back to various previous states.
i) create a blank text file called mapmate_bak.bat (or whatever you want as long as the ext is .bat). Right click on the file and select Edit (this should open notepad)
ii) copy and paste the lines of text below
:: start of script
:: user defined variables
SET locationOfMapMateInstall=c:\Users\paul.barrington\Documents\My MapMate\Data
:: display confirmation for user when script runs
@echo using directory %locationOfSnapshots% & echo.script set for %numberOfSnapshots% snapshots
@echo ** you can change these settings by editing the .bat file **
:: create snapshot folders the first time the script is run in each %locationOfSnapshots%
FOR /L %%G IN (1, 1, %numberOfSnapshots%) DO if not exist %locationOfSnapshots%\%%G mkdir %locationOfSnapshots%\%%G & echo - %locationOfSnapshots%\%%G created
:: delete the oldest snapshot (directory named 1)
:: rename directory 2 to 1, 3 to 2, 4 to 3 etc. to move older snapsnots down the chain
FOR /L %%G IN (2, 1, %numberOfSnapshots%) DO (
SET /a newName=%%G-1
ren %locationOfSnapshots%\%%G !newName!
:: copy the contents of the MapMate install directory to the location of snapshots. the directory name is the numberOfSnapshots value
xcopy "%locationOfMapMateInstall%\*.*" "%locationOfSnapshots%\%numberOfSnapshots%\" /s /r /d /y /i /q
@echo snapshot created %locationOfSnapshots%\%numberOfSnapshots%\
:: end of script
iii) change the user defined variables at the top as appropriate for you. number of snapshots determines how many generations you want to keep. in the example above I have used 7. each time the script runs the latest 7 backups of MapMate are retained. the oldest one is deleted once you have 7 backups.
iv) save changes and double click on the .bat file to run it or add it to the windows scheduler to run every n days / weeks. I would recommend running this manually immediately before doing any large imports / update queries. that way if new data or the query corrupts your record set you can just close mapmate and restore the most recent copy of the data directory. I've had to do this a few times when I've been given a large batch of duplicate records with different GUKs
Hope this helps.
note: having just proof read this post you could probably make the script for scenario 2 more efficient by using fc to compare the latest backup taken to the existing 'live' mapmate folder structure and including an if statement to only copy if something has changed. I dont have time to read up on fc at this time though. Let me know if this is any use. It has saved my bacon a few times as you never know what you might receive in new sync files :-)