[XP][VX] Data Backup Utility

Started by ForeverZer0, April 15, 2012, 10:51:27 pm

Previous topic - Next topic

ForeverZer0

Data Backup Utility
Authors: ForeverZer0
Version: 1.0
Type: File Backup Utility
Key Term: Game Utility



Introduction

Simple script for creating backups of your game each time the game is ran in debug mode that I pulled out of the archives. Its runs very quickly and there is practically no slowdown, even with large games. There isn't really a whole lot else to talk about.


Features


  • Place script anywhere above "Main"

  • Configure the number of backups you would like to keep.

  • Backups will be stored in the "Backups" folder in the main game directory, and are always listed in order of newest to oldest




Screenshots

None.


Demo

None.


Script

Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Data Backup Utility
# Author: ForeverZer0
# Date: 4.15.2012
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#   Simple script for creating backups of your game each time the game is ran
#   in debug mode. Its runs very quickly and there is practically no slowdown,
#   even with large games.
#
# Features:
#   - Backups your Data folder automatically each debug run
#   - Configurable number of backups
#   - Runs on a separate thread and invokes system functions for the actual
#     processing to prevent any slowdown
#
# Instructions:
#   - Place script anywhere above "Main"
#   - Configure the number of backups you would like to keep.
#   - Backups will be stored in the "Backups" folder in the main game directory,
#     and are always listed in order of newest to oldest
#
# Credit/Thanks:
#   - ForeverZer0, for the script
#
# Authors Notes:
#   - Please report any bugs issues at www.chaos-project.com
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

module Backup
 
  MAX_BACKUPS = 10
 
  def self.create
    system("rd /s/q \"Backups\\Backup #{MAX_BACKUPS}\"")
    (1...MAX_BACKUPS).to_a.reverse.each {|i|
      dir_name = "Backups/Backup #{i}"
      Dir.mkdir(dir_name) unless File.directory?(dir_name)
      File.rename(dir_name, "Backups/Backup #{i + 1}")
    }
    system('xcopy Data "Backups\\Backup 1" /Y/D/I')
  end
end

if $DEBUG
  Thread.new { Backup.create }
end



Instructions


  • Place script anywhere above "Main"

  • Configure the number of backups you would like to keep.

  • Backups will be stored in the "Backups" folder in the main game directory, and are always listed in order of newest to oldest




Compatibility

Will work with any Windows system, so long as your game contains a "Data" folder.


Credits and Thanks


  • ForeverZer0, for the script




Author's Notes

Please report any bugs issues at www.chaos-project.com.
Enjoy!
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.