The plugin below automatically backups up your world file to a new name every day. It does it on a connect, and a disconnect. The name used is the existing file name, with the date added, eg.
Since the file name has just the day/month/year in it, you will only get one file per day. This saves your disk filling up with thousands of files. And if something goes wrong, the most recent backup would be only a day old.
This plugin will be supplied with MUSHclient version 4.61 onwards.
C:\Program Files\MUSHclient\worlds\SmaugFUSS-backup-08-Sep-2010.MCL
Since the file name has just the day/month/year in it, you will only get one file per day. This saves your disk filling up with thousands of files. And if something goes wrong, the most recent backup would be only a day old.
To save and install the Automatic_Backup plugin do this:
- Copy the code below (in the code box) to the Clipboard
- Open a text editor (such as Notepad) and paste the plugin code into it
- Save to disk on your PC, preferably in your plugins directory, as
Automatic_Backup.xml- The "plugins" directory is usually under the "worlds" directory inside where you installed MUSHclient.
- Go to the MUSHclient File menu -> Plugins
- Click "Add"
- Choose the file
Automatic_Backup.xml(which you just saved in step 3) as a plugin - Click "Close"
- Save your world file, so that the plugin loads next time you open it.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="Automatic_Backup"
author="Nick Gammon"
id="bb6a05ed7534b5db1ed40511"
language="Lua"
purpose="Backs up the world file to a new name each day"
date_written="2010-09-08 09:38:17"
requires="4.40"
version="1.0"
>
<description trim="y">
<![CDATA[
Install to backup your world file to a file of the same name with the day/month/year added to it.
]]>
</description>
</plugin>
<script>
<![CDATA[
function do_backup ()
-- find name of world file
local world_file_name = GetInfo (54)
-- if found (ie. not just newly created) back it up
if world_file_name and world_file_name ~= "" then
-- strip out .MCL (or .mcl), add the date, and put .MCL back
world_file_with_date = string.gsub (world_file_name, "%.[Mm][Cc][Ll]$", "") ..
os.date ("-backup-%d-%b-%Y.MCL")
-- save if possible
if (Save (world_file_with_date, true) == false) then
ColourNote ("orange","", "World file backed up as " .. world_file_with_date)
else
ColourNote ("red", "", "Could not back up world file.")
end -- if
end -- if world file name known
end -- do_backup
-- back when first connecting
function OnPluginConnect ()
do_backup ()
end -- OnPluginConnect
-- back up when disconnecting (eg. after improving it)
function OnPluginDisconnect ()
do_backup ()
end -- OnPluginDisconnect
]]>
</script>
</muclient>
This plugin will be supplied with MUSHclient version 4.61 onwards.