Here is a simple script. We are doing some testing with INM and we are making some frequent settings changes. While INM allows us to backup the settings file automatically once a day, week or month, we needed a little more control over this. To handle it, I created this simple script that will copy a file to a specified destination folder and set up a monitor to run this script once an hour. Using the parameters below, it will copy our settings file to the specified folder allowing us to keep a history (the copied file is tagged with the data and time)

QUOTE
"d:\\Program Files\\Intellipool Network Monitor" settings.nxd d:\\INMSettingsBackup


The first parameter is the directory the file is in (Leave off the trailing \)
The second parameter is the name of the file that I want to copy
The third parameter is the destination folder I want to put my copies.


CODE
----------------------------------------------------------------------------------------------------------
-- Name: BackupFile.lua
-- Version: 1.0
-- Date: 2007-11-28
-- Description: Creates a backup copy of a file in the specified folder.  Files are tagged with
-- the script execution time in YYYYMMDDhhmmss format.
-- Arguments:
-- 1) Path of file to backup
-- 2) Name of file to backup
-- 2) Destination Folder to copy to
----------------------------------------------------------------------------------------------------------

backuppath = GetArgument(0);
backupfile = GetArgument(1);
destination = GetArgument(2);

--get the current date
d = TLuaDateTime();

--build the path to the file to backup.
fn = backuppath .. "\\" .. backupfile;

--build the path to the destination file name.
fn2 = destination .. "\\" .. backupfile .. "." .. d:GetDate("%Y%m%d") .. "_" .. d:GetTime("%H%M%S");

--copy the file to the destination.
file = TLuaFile();
result = file:CopyFile(fn, fn2);

if (result == 0) then
    error = GetLastError();
    errdesc = FormatErrorString(error);
    SetExitStatus(error .. " - " .. errdesc,false);

else
    SetExitStatus("File copied to " .. fn2,true);
end