VBScript

15 pts.
Tags:
VBScript
Windows scripting
How can I use VBScript to copy the contents of a folder (including subfolders), but I only want it to copy new files/folders or ones that have been modified since the last copy.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

I would recommend using robocopy instead of VBScript. Robocopy does this by default. If is part of the Windows 2000 resource kit.

Robocopy was included in the OS starting in Windows XP forward. The existing switches in one version are generally the same across newer versions. Add a check in your script for robocopy and copy to the system if not present (you may want to include OS version checking). Then you can use it to manage your copying. Great thing is robocopy provides a logging facility.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Davlyn
    But that would involve downloading and installing it on all the systems that I am trying to have copy the files automatically 300+. I have a batch file that triggers durring startup, but it copies ALL the FIles, and none of the Sub-folders everytime the computer is started, which is what we want, but it would speed things up if it just do the files that are new, or have been modified, and we still need it to do the sub-folders.
    15 pointsBadges:
    report
  • Denny Cherry
    Take the EXE, and wrap it up in an MSI using one of the MSI creation tools. Then use Active directory to install the MSI on all your systems. Or you can setup your existing batch file to copy the robocopy.exe from an fixed location to the local servers system32 folder then it will be available the next time you need it. Robocopy doesn't actually need to be installed. Windows comes with everything you need for it to run automatically. robocopy has switches which will will go through the folders and it automatically only copies files which have been changed since the last time it was run. Robocopy is still going to be your best option.
    68,900 pointsBadges:
    report
  • Labnuke99
    Consider also using the excellent Sysinternals tools like psexec. This will allow you to copy and remotely execute a program on computers with authorized credentials.
    32,960 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: