Good day!.

I want to copy all the folder contents to a certain location. To be specific, i have a folder named (webproject) relative on my vb program path.When the form load, i want to copy all the content of this folder(webproject) to C:\wamp\wwww\onlineweb\.I just really dont know how to start the coding. If someone can help me to solve this problem thank you very many much

God bless on this mother earth.

I have always loved the power of API's :D

This will help you...

Private Declare Function SHFileOperation Lib "shell32.dll" _
Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long

'~~> Copy File/Folder
Private Const FO_COPY = &H2
'~~> Does not display file names
Private Const FOF_SIMPLEPROGRESS = &H100

    hWnd As Long
    wFunc As Long
    pFrom As String
    pTo As String
    fFlags As Integer
    fAnyOperationsAborted As Long
    hNameMappings As Long
    lpszProgressTitle As Long
End Type

Private Sub VBCopyFolder(ByRef strSource As String, ByRef strTarget As String)
    With op
        .wFunc = FO_COPY
        .pTo = strTarget
        .pFrom = strSource
        .fFlags = FOF_SIMPLEPROGRESS
    End With
    '~~> Perform operation
    SHFileOperation op
End Sub

Private Sub Command1_Click()
    '~~> Copy Folder C:\temp\1 to C:\temp\2
    '~~> Change this to relevant folders
    Call VBCopyFolder("C:\temp\1", "C:\temp\2")
End Sub

Thank you guys. I havent try it yet. I will do this now. I know this will i can look at the code. I have read thid API already. I will mark this problem solved.

Thank you very much guys again. Hope to see you all on next thread.!

God bless on this mother earth.

This question has already been answered. Start a new discussion instead.