Hi All,

I have a File distribution script that works really well, but due to issues with Word, (our normal.dot keeps corrupting, which switching to read only fixed) but when ever I run an update and distribute it to all staff here, I can't replace a read only file. Script log says "permissions denied" re (error code 70)

I thought that maybe adding the Script to delete the file first, then replace it with the copied version, but I'm not 100% if this script can be modified to include that.

I could just create a short script to delete them first, then run the update, but I'd prefer to run just one.
Code:
Dim fso, f, fc, f1, SourceFolder
Set fso = CreateObject("Scripting.FileSystemObject")
Set SourceFolder = fso.Getfolder("D:\Folder1\Noticeboard\Normalupdates\Normal_XP\Normal.dot")
Set f = fso.Getfolder("D:\Folder1\")
Set fc = f.SubFolders
For Each f1 In fc

If InStr(f1.Name, ",") > 0 Then
    On Error Resume Next
        SourceFolder.Copy f1 & "\Databases\"
        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
mystr = mystr & " -- File Distribution Completed -- " & vbNewLine
Set f1 = fso.CreateTextFile("d:\Folder1\noticeboard\Update Script Logs\Normaldeletelog.txt", True)
f1.Write mystr
f1.Close
Set f1 = Nothing
Set fso = Nothing