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
| Dim rep1, rep2
rep1 = "D:\Office10"
rep2 = "D:\Nouveau dossier"
Function VerifMiroir( repSource, repDest )
Dim oFSO, oFl, oFld
Set oFSO = CreateObject("Scripting.FileSystemObject")
If (oFSO.FolderExists(repSource) and oFSO.FolderExists(repDest)) Then
For each oFld in oFSO.GetFolder(repDest).SubFolders
If oFSO.FolderExists( (repSource & "\" & oFld.Name) ) Then
VerifMiroir (repSource & "\" & oFld.Name), oFld
Else
oFld.Delete True
End If
Next
For each oFl in oFSO.GetFolder(repDest).Files
If not oFSO.FileExists( (repSource & "\" & oFl.Name) ) Then
oFl.Delete True
End If
Next
End If
End Function
VerifMiroir rep1, rep2
MsgBox "Traitement terminé" |