ney
asked on
Copy a directory
How can I make a backup copy of a given directory?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
'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.Fi leSystemOb ject")
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
'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.Fi
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
ASKER
Thanks a lot
use SHFileOperation API for thet
Hope this helps