Link to home
Start Free TrialLog in
Avatar of ney
ney

asked on

Copy a directory

How can I make a backup copy of a given directory?
Avatar of inpras
inpras

Hi
use SHFileOperation API for thet

Hope this helps
ASKER CERTIFIED SOLUTION
Avatar of Vbmaster
Vbmaster

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
'copy the contents of a directory to a directory or folder on a different drive
'copies files and folders seperately as they use different vehicles
'this example copies all of a:\ to c:\mydocuments


Public Sub CopyA()
    Dim FSO As Object
    On Error GoTo NOFSO
    Set FSO = CreateObject("Scripting.FileSystemObject")

    On Error Resume Next
    FSO.CopyFile "A:\*", "C:\My Documents\", True
    FSO.CopyFolder "A:\*", "C:\My Documents\", True
    Set FSO = Nothing
    Exit Sub
NOFSO:
    MsgBox "FSO CreateObject Failed"
End Sub

'vbWayne
Avatar of ney

ASKER

Thanks a lot