This sounds like you need to create a Windows Service. A windows service will run even when you are not logged in. Of course to do that, you would have to have Admin privileges and the VBScript would have to be in C# or VB.
The following code (in C#) can be used to create a windows service to move files every 10 seconds and rename files if the file being moved already exists in the destination folder.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
using System.IO;
using System.Timers;
namespace Cron
{
partial class Service2 : ServiceBase
{
private Timer ti = new Timer();
private string fileTime;
private string[] theCommands = new string[2];
private EventLog eventLog1 = new EventLog();
private FileStream fs;
public Service2()
{
InitializeComponent();
ti.Elapsed += new ElapsedEventHandler(ti_Elapsed);
ti.Interval = 10000;
ti.Enabled = true;
if (!System.Diagnostics.EventLog.SourceExists("CronMessage"))
{
System.Diagnostics.EventLog.CreateEventSource(
"CronMessage", "CronLog");
}
eventLog1.Source = "CronMessage";
eventLog1.Log = "CronLog";
}
void ti_Elapsed(object sender, ElapsedEventArgs e)
{
try
{
MoveFiles(theCommands[0], theCommands[1]);
}
catch (Exception ex)
{
eventLog1.WriteEntry(ex.Message, EventLogEntryType.Error);
}
}
public void MoveFiles(string sourceFolder, string destFolder)
{
try
{
DateTime dt = DateTime.Now;
string year = dt.Year.ToString("0000");
string month = String.Format("{0:MMM}", dt);
string day = dt.Day.ToString("00");
string hour = dt.Hour.ToString("00");
string min = dt.Minute.ToString("00");
string sec = dt.Second.ToString("00");
string time = year + month + day + "_" + hour + min + sec;
if (Directory.Exists(destFolder))
{
string[] files = Directory.GetFiles(sourceFolder);
foreach (string file in files)
{
string name = Path.GetFileName(file);
string dest = Path.Combine(destFolder, name);
if (File.Exists(dest))
{
name = Path.GetFileNameWithoutExtension(file) + time + Path.GetExtension(file);
}
dest = Path.Combine(destFolder, name);
File.Move(file, dest);
}
string[] folders = Directory.GetDirectories(sourceFolder);
foreach (string folder in folders)
{
string name = Path.GetFileName(folder);
string dest = Path.Combine(destFolder, name);
MoveFiles(folder, dest);
}
}
else
{
throw new Exception("Folder does not exist!\nPlease check the file: " + fs.Name);
}
}
catch (Exception ex)
{
eventLog1.WriteEntry(ex.Message, EventLogEntryType.Error);
}
}
protected override void OnStart(string[] args)
{
eventLog1.WriteEntry("Cron Backup service started.");
fs = File.OpenRead("C:\\Path\\to\\text\\file");
StreamReader sr = new StreamReader(fs);
sr.ReadLine();
theCommands[0] = sr.ReadLine();
sr.ReadLine();
sr.ReadLine();
theCommands[1] = sr.ReadLine();
fs.Close();
}
protected override void OnStop()
{
eventLog1.WriteEntry("Cron Backup service stopped.");
}
}
}
The text file can contain a UNC Path (i.e. \\servername\somefolder) and should work as long as the Local System account has access to that folder.
Example of Text file:
[Source Folder]<br />
\\ServerName\some_Folder<br />
<br />
[Destination Folder]<br />
C:\Some_Folder<br />
If people have enough interest in this, I can expound on the subject.