I had the similar situation, what I was doing before copying the files to destination I'm checking the filesize and last modified if it changes then replace else do nothing.
I don't know how much this will help you, but give a try.
Function Main()
script3
Main = DTSTaskExecResult_Success
End Function
sub script3()
fromDir = DTSGlobalVariables("gvSrcPath").Value 'Source Path
toDir = DTSGlobalVariables("gvDestPath").Value 'Destination Path
start = Now()
replaceSize = 0
copySize = 0
deleteSize = 0
noChangeSize = 0
If fso.FolderExists(fromDir) And fso.FolderExists(toDir) Then
Call ReplicateDirectory(fromDir, toDir)
Else
logFile.WriteLine("Error ...................... : No directory found")
End If
End sub
Sub ReplicateDirectory(source, target)
Dim t, objShell, CmdLine, rc
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set targetDir = fso.GetFolder(target)
Set sourceDir = fso.GetFolder(source)
Set targetDirFileList = targetDir.Files
Set sourceDirFileList = sourceDir.Files
Set targetDirFolderList = targetDir.SubFolders
Set sourceDirFolderList = sourceDir.SubFolders
'Overwriting files at Destination Directory
For Each targetFile in targetDirFileList
If fso.FileExists(source & "\" & targetFile.Name) Then
Set sourceFile = fso.GetFile(source & "\" & targetFile.Name)
If targetFile.DateLastModified <> sourceFile.DateLastModified Then
targetFilePath = targetDir.Path & "\" & targetFile.Name
replaceSize = replaceSize + sourceFile.Size
sourceFile.Copy targetFilePath
sourceFile.Delete
Else
noChangeSize = noChangeSize + sourceFile.Size
End If
Else
noChangeSize = noChangeSize + targetFile.Size
End If
Next
For Each sourceFile in sourceDirFileList
If Not fso.FileExists(target & "\" & sourceFile.Name) Then
copySize = copySize + sourceFile.Size
sourceFile.Copy targetDir.Path & "\" & sourceFile.Name
sourceFile.Delete
End If
Next
For Each sourceFolder in sourceDirFolderList
If Not fso.FolderExists(targetDir & "\" & sourceFolder.Name) Then
copySize = copySize + sourceFolder.Size
sourceFolder.Copy(targetDir & "\" & sourceFolder.Name)
Else
Call ReplicateDirectory(sourceFolder.Path, targetDir & "\" & sourceFolder.Name)
End If
Next
'logFile.Close()
finish = Now()
End Sub
Good Luck,
Gragi