|
-
Feb 4th, 2008, 12:02 PM
#1
Thread Starter
Lively Member
VBscript help..
The below code works like a dream, it copies one file and distributes it to a large number of directories on a shared folder located on our server, it also records the directories it has skipped due to error.
Throughout the shared folder, there is a mix of different Normal.dot templates, some get one and some get another. We differentiate between each user by having a folder in each users directory called either 'Normal' or 'Normal_PM', I use the two versions of this script to do this.
When the script run and updates, it records errors but it also records non-errors due to the file path being different IE
K:\Named, Folder\Databases\Normal - Path Not Found (this isn't an error it's just a different file path)
Is there a line of code I can add to this script that can say something like -
If file path is "Databases\Normal_PM" skip and resume next?
Code:
Dim fso, f, fc, f1, SourceFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set SourceFile = fso.GetFile("K:\Noticeboard\NormalUpdates\Normal\Normal.dot")
Set f = fso.GetFolder("K:\")
Set fc = f.SubFolders
For Each f1 In fc
If InStr(f1.Name, ",") > 0 Then
On Error Resume Next
SourceFile.Copy f1 & "\Databases\normal\"
If Err.Number <> 0 Then
Select Case Err.Number ' Evaluate error number.
Case 70
mystr = mystr & F1 & " - Permission Denied" & vbnewline 'add to string here
Case 76
mystr = mystr & f1 & " - Path not found" & vbnewline ' add to string here
Err.Clear
Case Else
End Select
Else
End If
On Error GoTo 0
End If
Next
Set F1 = fso.CreateTextFile("K:\Noticeboard\Update Script Logs\NormalUpdateScriptLog.txt", True)
f1.Write mystr
f1.Close
Set f1 = nothing
set fso = nothing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|