Advertisement

07.14.2008 at 10:00AM PDT, ID: 23563317
[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.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

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!

9.8

Renaming file with a script

Asked by barrykeel in VB Script, Windows 2003 Server, Microsoft Server

Tags: , ,

I have a script that will email the newest logfile in a folder via email. I need to have the extension changed fron .log to .txt before it emails. Posted is the working script. I cannot figure out how to chage the name.Start Free Trial
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:
Option Explicit 
 
   Dim objMessage, oFS 
 
 
   Set oFS = WScript.CreateObject("Scripting.FileSystemObject") 
 
   Dim sLogFdr, oLogFdr, sLogFile, oLogFile 
   Dim iIndex, iNewest 
 
   sLogFdr = "C:\Documents and Settings\user\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data" 
 
   Set oLogFdr = oFS.GetFolder(sLogFdr) 
     If oLogFdr.Files.Count = 0 Then Call CleanUp("ERROR: No NTBackup Log Files present!") 
 
   Redim Preserve aLogFiles(oLogFdr.Files.Count -1) 
 
   iIndex = 0 
   For Each sLogFile In oLogFdr.Files 
     aLogFiles(iIndex) = oFS.GetFile(sLogFile).Path 
     iIndex = iIndex + 1 
   Next 
 
   iNewest = 0 
   For iIndex = 1 To UBound(aLogFiles) 
     If oFS.GetFile(aLogFiles(iNewest)).DateLastModified < oFS.GetFile(aLogFiles(iIndex)).DateLastModified Then
       iNewEst = iIndex 
     End If 
   Next 
 
 
Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = "Log File" 
objMessage.From = "user@yourdomain.com" 
objMessage.To = "user@yourdomain.com.com" 
objMessage.TextBody = "Attached is the Log File."
objMessage.AddAttachment oFS.GetFile(aLogFiles(iNewest)).Path 
 
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
 
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mailserver.yourdomain.com"
 
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
 
objMessage.Configuration.Fields.Update
 
objMessage.Send
 
   Call CleanUp("") 
 
   Sub CleanUp(sExitMsg) 
     If Not sExitMsg = "" Then MsgBox sExitMsg,,"Exit Message" 
  
     Set oFS = Nothing 
     WScript.Quit 
   End Sub 
 
   Function IsFolder(fName) 
     If oFS.FolderExists(fName) Then IsFolder = True Else IsFolder = False 
   End function
[+][-]07.14.2008 at 10:51AM PDT, ID: 22000324

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: VB Script, Windows 2003 Server, Microsoft Server
Tags: Microsoft, Windows, Server 2003
Sign Up Now!
Solution Provided By: purplepomegranite
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628