Ver Mensaje Individual
  #4 (permalink)  
Antiguo 13/05/2010, 11:42
Avatar de lokoman
lokoman
 
Fecha de Ingreso: septiembre-2009
Mensajes: 502
Antigüedad: 14 años, 7 meses
Puntos: 47
Respuesta: es posible hacer en vb?

Hola!
Aqui tienes para sincronizar directorios:

Sub SynchronizeDirectoryTrees(ByVal sourceDir As String, ByVal destDir As String, Optional ByVal TwoWaySync As Boolean)
Dim fso As New Scripting.FileSystemObject
Dim sourceFld As Scripting.Folder
Dim destFld As Scripting.Folder
Dim fld As Scripting.Folder
Dim col As New Collection

On Error Resume Next

Set sourceFld = fso.GetFolder(sourceDir)
Set destFld = fso.GetFolder(destDir)

If Err Then
fso.CopyFolder sourceDir, destDir
Exit Sub
End If

SynchronizeDirectories sourceDir, destDir, TwoWaySync

If Right$(sourceDir, 1) <> "\" Then sourceDir = sourceDir & "\"
If Right$(destDir, 1) <> "\" Then destDir = destDir & "\"

For Each fld In sourceFld.SubFolders
col.Add fld.Name, fld.Name
SynchronizeDirectoryTrees fld.path, destDir & fld.Name, TwoWaySync
DoEvents
Next

If TwoWaySync Then
For Each fld In destFld.SubFolders
If col(fld.Name) = "" Then
fso.CopyFolder fld.path, sourceDir & fld.Name
End If
Next
End If
End Sub

Para usarlo:
Call SynchronizeDirectoryTrees(txtSource, txtDestination, False)

No utilices código con fines dañinos.