Advertisement
| 10.02.2008 at 11:22AM PDT, ID: 23782628 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: |
'<<<<<<<<<<<<DEFINE VARIABLES HERE-BEGIN>>>>>>>>>>>>>>>>>>
DIM cutoff, curyear, scriptStatus, mailto, mailfrom, maillog
'DEFINE CUTOFF DATE (LOG FILES OF DATES OLDER THAN THIS DATE SHOULD BE DELETED)
'SPECIFY CUTOFF DATE IN CENTER PARAMETER
cutoff = dateadd("d", -10, date)'wscript.echo "Cut off=" & cutoff
'GET CURRENT YEAR FOR REGULAR EXPRESSION TO PERFORM LOG DELETION
curyear = year(now) 'wscript.echo "Current Year=" & curyear
'PARAMETER TO ENABLE LOGS TO BE DELETED
'SET TO 'ON' TO ENABLE 'OFF' TO DISABLE
scriptStatus = "ON"
'EMAIL TO ADDRESS (Add multiple by seperating with commas)
mailto = "me@me.com"
'EMAIL FROM ADDRESS (Add multiple by seperating with commas)
mailfrom = "me@me.com"
'<<<<<<<<<<<<DEFINE VARIABLES HERE-END>>>>>>>>>>>>>>>>>>
'++++++++++++++++++++++++EMAIL CONFIGURATION BEGIN++++++++++++++++++++++++++++++++++
set maillog = createobject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.
maillog.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
maillog.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mx01exchange.me.com"
maillog.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
maillog.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
maillog.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
maillog.Configuration.Fields.Update
'End remote SMTP server configuration section==
maillog.from = mailfrom
maillog.to = mailto
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if scriptStatus = "ON" then
'DELETE ALL RDTemp FILES
arrayHeaders = array("AccountSystem", "AsyncQueue")
arrayTotal = UBound(arrayHeaders)
'wscript.echo arrayHeaders(0)
if arrayHeaders(0) = "AccountSystem" then
'DELETE ALL ACCOUNTSYSTEM LOG FILES
cleanup "D:\MyApp\LOG\Accountsystem", "^"&curyear& ".*?\.log$", cutoff
if arrayHeaders(1) = "AsyncQueue" then
'DELETE ALL ASYNCQUEUE LOG FILES
cleanup "D:\MyApp\LOG\AsyncQueue", "^"&curyear& ".*?\.xml$", cutoff
end if
end if
''''''''''''''''''''''''''''''''''''''''''''''''
'-------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------
'******************FUNCTIONS USED TO DELETE FILES************************************
Sub cleanup(folderName, pattern, cutoff)
Set fso = createobject("scripting.filesystemobject")
Set folder = fso.getfolder(folderName)
Set files = folder.files
Set re = new regexp
re.Pattern = pattern
countFiles = 0
countSize = 0
file = j
For each file in files
If re.Test(file.name) Then
If file.datelastmodified < cutoff Then
'wscript.echo "Deleting " & file.name &" last modified: " & file.datelastmodified
'wscript.echo countFiles
'wscript.echo "Clean up=" & cleanup
countFiles = countFiles + 1
countSize = countSize + file.Size
strbody = strbody &vbCrLf & countFiles & ":" & "Deleted" & file.name &" last modified: " & file.datelastmodified & vbCrLf
maillog.textbody = strbody
countFilesFINAL = countFiles
On Error Resume Next
file.delete
End If
End If
Next
'wscript.echo "Deleted " & countFiles & " files from " & folderName & " [" & niceSize(countSize) & "]"
maillog.subject = "ATTENTION: "&countFilesFINAL& " logs and files older than " & cutoff & " have been deleted"
Set re = Nothing
Set files = Nothing
Set folder = Nothing
Set fso = Nothing
'maillog.subject = "ATTENTION: "&countFilesFINAL& " logs and files older than " & cutoff & " have been deleted"
End Sub
Function niceSize(size)
units = "B"
If size > 1024 Then
size = Round(size / 1024, 1)
units = "kB"
End If
If size > 1024 Then
size = Round(size / 1024, 2)
units = "MB"
End If
If size > 1024 Then
size = Round(size / 1024, 3)
units = "GB"
End If
niceSize = "" & size & units
End Function
'*************************************************************************************
elseif scriptStatus = "OFF" then
maillog.subject = "ATTENTION: RE: The RedDot logs and files deletion script did not run properly"
cleanupOFF = "The script is turned off"
'wscript.echo cleanupOFF
strbody = cleanupOFF
maillog.textbody = strbody
end if
maillog.send
Set maillog = nothing
|
Advertisement