rules.vbs schedule it in windows using csript. Change drive letters and paths to match
your settings.
**********************************
rem *** invoke it with : cscript
rem *** Script checks subfolders below the specified root and copies template
rem *** V2 - Will skip files that are hidden or read-only
dim strFileName
dim nowDate
dim intDateBack
dim strLogFolder
dim strFilePath
Dim fs, f, f1, fc, s
TemplateFile = "D:\IMail\master\bounce.fwd"
TemplateFile2 = "D:\IMail\master\alertbox.fwd"
strFilePath = "D:\Imail"
strLogDump = "D:\Imail\Copiedrules-users.txt"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fs = wscript.CreateObject("Scripting.FileSystemObject")
Set fs2 = wscript.CreateObject("Scripting.FileSystemObject")
CheckFiles strFilePath
Set fs2 = nothing
Set fc= nothing
Set f = nothing
Set a = nothing
Set fs = nothing
Set FSO=nothing
' ****************************************************************************
' This function copies the template to each of the folders received as parameters
Sub CopyFileTo (strFilePathLong)
On Error Resume Next
' copy template1 to this folder, checking attributes first...
filename1=strFilePathLong & "\"
FSO.CopyFile TemplateFile, filename1 , TRUE
s = s & filename1
s = s & vbCrLf
' copy template2 to this folder, checking attributes first...
filename1=strFilePathLong & "\"
FSO.CopyFile TemplateFile2, filename1 , TRUE
' s = s & filename1
' s = s & vbCrLf
' write a log with the files removed...
if fs.FileExists(strLogDump) then
fs.DeleteFile(strLogDump)
end if
Set a = fs.CreateTextFile(strLogDump, 8,0)
a.WriteLine(s)
a.Close
End Sub
' ****************************************************************************
' This function check for files inside the folder, and erases old files there
Sub CheckFiles (strFilePathLong)
' First check files in this folder...
Set g = fs2.GetFolder(strFilePathLong)
Set gc = g.Files
' Now check folders inside this one
Set gc2 = g.SubFolders
For each g1 in gc2
strFilePathLong = g1.path
CopyFileTo strFilePathLong
CheckFiles strFilePathLong
Next
End Sub
****************************************
To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/