Copy Date stamp folder from one location to another

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Codebuster
    New Member
    • Jun 2014
    • 2

    #1

    Copy Date stamp folder from one location to another

    Hi all i am searching this from a long time but didn't find any answer for this, as i am new to programming i m unable to modify codes also.

    What i want is to copy datestamp folder from one location to another, everyday we are getting datestamp folder i want to move the whole folder to some other location..
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3665

    #2
    Codebuster,

    What have you tried so far? There are numerous ways to copy files, but here is some cod eto get you started.

    Code:
    Public Function CopyFolder(SourceFolder As String, DestinationFolder As String, _
        OverWriteFiles As Boolean) As Boolean
    '**********************************************************************************
    '* Purpose:  Allows user to Copy a fodler and its files to a new location         *
    '* Accepts:  SourceFolder      = Location of the source folder                    *
    '*           DestinationFolder = Destination location of where to copy the folder *
    '*           OverWriteFiles    = Indicates whether to overwrite existing files    *
    '* Returns:  Ture/False; indicates whether or not function was successful         *
    '* ********************************************************************************
    On Error GoTo EH
        Dim FSO As Object
        CopyFolder = False
        Set FSO = CreateObject("Scripting.FileSystemObject")
        FSO.CopyFolder SourceFolder, DestinationFolder, OverWriteFiles
        CopyFolder = True
    EH_Exit:
        On Error Resume Next
        Set FSO = Nothing
        Exit Function
    EH:
        If Err.Number = 76 Then
            MsgBox "The Source Folder '" & SourceFolder & "' could not be found.  " & _
                "Please contact your Database Administrator", vbCritical, "Copy Error!"
        Else
            MsgBox "There was an error copying the Folder.  " & _
                "Please contact your Database Administrator", vbOKOnly, "Copy Error!"
        End If
        Resume EH_Exit
    End Function
    Hope this hepps!

    Comment

    Working...