Backup System
by .:Fênix:.
by .:Fênix:.
Description
Makes a copy of your game's folders
Compability
RPG Maker XP and RPG Maker VX
Script
- #===============================================================================
- # * Backup System
- #-------------------------------------------------------------------------------
- # - Version: 2.0
- # - Date : 21 / 08 / 2011
- # - Author : .:Fênix:.
- # - MSN : [email hidden]
- #-------------------------------------------------------------------------------
- # - Description:
- # Makes a copy of your game's folders
- #-------------------------------------------------------------------------------
- # - Compability:
- # RPG Maker XP and RPG Maker VX
- #===============================================================================
- module Backup_System
- # Activate the script? (true / false)
- Activate = true
- # Copy Audio folder? (true / false)
- Audio = false
- # Copy Data folder? (true / false)
- Data = true
- # Copy Graphics folder? (true / false)
- Graphics = false
- # Seconds to make a new copy (if you set this 0, it will make
- # a copy every time you run the game)
- Time = 3600
- end
- if (Backup_System::Activate)
- $VX ||= defined?(Graphics.wait)
- if (File.file?("Game.rgss#{$VX ? '2a' : 'ad'}"))
- Thread.new {system("rd Backup /s /q")} if (File.directory?("Backup"))
- File.delete("Backup.time") if (File.file?("Backup.time"))
- else
- if (($DEBUG) || ($TEST))
- time = Time.now
- if ((!File.file?("Backup.time")) || ((time - load_data("Backup.time")) >= Backup_System::Time))
- baseDir = ""
- for subDir in ["Backup/", "#{time.year}-#{time.month}-#{time.day}/", "#{time.hour}.#{time.min}.#{time.sec}/"]
- baseDir += subDir
- Dir.mkdir(baseDir) unless (File.directory?(baseDir))
- end
- for subDir in ["Audio", "Data", "Graphics"]
- next unless (eval("Backup_System::#{subDir}"))
- dir = baseDir + subDir
- Dir.mkdir(dir) unless (File.directory?(dir))
- Thread.new {system("xcopy #{subDir}" + ' "' + dir.gsub!("/", "\\") + '" /e /c /q /r /y')}
- end
- save_data(time, "Backup.time")
- end
- end
- end
- end
Expand to see the code.