<package>
<job id="manage_folder">
<script language="vbscript">
Option Explicit
On Error Resume Next
Dim strFolderToMonitor, strFolderToCopyTo, intFileSizeLimit
' Only change these variables.
strFolderToMonitor = "<PATH>" ' Full path to the folder to monitor. (eg. c:\original) -- DO NOT USE A TRAILING SLASH!
strFolderToCopyTo = "<PATH>" ' Full path to the destination folder. The files from the above folder will be copied here. Same format as above.
intFileSizeLimit = 700 ' The maximum file size in MB. Once the contents of the original folder reach this size, they will be copied over.
' Declare objects.
Dim FSO: Set FSO = CreateObject("Scripting.FileSystemObject")
' Check to see if the source and destination folders exist.
If FSO.FolderExists(strFolderToMonitor) And FSO.FolderExists(strFolderToCopyTo) Then
Dim FolderToMonitor
Set FolderToMonitor = FSO.GetFolder(strFolderToMonitor)
' Check the folder size. It's returned in bytes so convert it to match MB value above.
If FolderToMonitor.Size >= (intFileSizeLimit * 1024) * 1024 Then
Dim File
' The folder size was greater than fileSizeLimit specified, copy each of the files from the original folder over to the destination.
For Each File in FolderToMonitor.Files
File.Copy(strFolderToCopyTo & "\")
If Not Err Then
' The file was successfully copied, delete it from the original folder.
File.Delete
End If
Next
End If
Set FolderToMonitor = Nothing
End If
Set FSO = Nothing
WScript.Quit
</script>
</job>
</package>
cscript ManageFolder.wsf
You could also write a small script that you could attach to a scheduled task that could check the folder size each hour (or for whenever you specify) and then copy the folder contents over to your burn folder. I'm not sure of what your proficiency is with Windows so I haven't provided the script code here. Let me know if you want it.
posted by purephase at 9:29 AM on November 20, 2005