• Wscript CopyFolder (English)

    Author
    Topic
    #433993

    Can anyone help me with the Windows Scripting CopyFolder. I am looking for a means to copy newer files only from one folder to another, using windows scripting

    Viewing 0 reply threads
    Author
    Replies
    • #1022235

      The fileSystemObject.CopyFolder method has only two settings for overwriting existing files: do it, or don’t do it. The same is true of the fileSystemObject.CopyFiles method. You may well have to check for the existence in your “destination” folder of every file in your “source” folder and, if it exists, compare the dates. That seems like a lot of coding… might there be some other function or utility available?

      • #1022265

        If you run XCopy from a command prompt there is a /D parameter which only copies newer files. It should be possible to run this from script with a Shell object – something like:

        dim sh
        set sh = WScript.CreateObject("WScript.Shell")
        sh.run "XCOPY C:Test*.txt C:TestTest2 /D /Y", 0, True
        

        HTH

    Viewing 0 reply threads
    Reply To: Wscript CopyFolder (English)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: