|
|
|
Click here to copy the following block |
Sub SynchronizeDirectories(ByVal sourceDir As String, ByVal destDir As String, _ Optional ByVal TwoWaySync As Boolean) Dim fso As New Scripting.FileSystemObject Dim index As Long Dim copyDirection As Integer Dim arr() As Variant arr = CompareDirectories(sourceDir, destDir) If Right$(sourceDir, 1) <> "\" Then sourceDir = sourceDir & "\" If Right$(destDir, 1) <> "\" Then destDir = destDir & "\" For index = 1 To UBound(arr, 2) copyDirection = 0 Select Case arr(1, index) Case cdeEqual Case cdeSourceDirOnly copyDirection = 1 Case cdeDestDirOnly copyDirection = 2 Case Else If arr(1, index) = cdeAttributesDiffer Then ElseIf (arr(1, index) And cdeDateDiffer) = cdeSourceIsOlder Then copyDirection = 2 Else copyDirection = 1 End If End Select If copyDirection = 1 Then fso.CopyFile sourceDir & arr(0, index), destDir & arr(0, index), _ True ElseIf copyDirection = 2 And TwoWaySync Then fso.CopyFile destDir & arr(0, index), sourceDir & arr(0, index), _ True End If Next End Sub |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|