vbscript >> script for Robocopy

by Todd Hudson » Fri, 23 May 2008 07:29:29 GMT

I have a requirement to have data backed up from multiple external USB
devices to a single USB device.

All of the USB devices are named the same except for the target.

What I am looking for is a simple script to copy data from all external
drives to a single external drive. The query could be to:

Look for drive named Target. Then copy all data from source path to target
path on all external drives except for the one named Target.

Willing pay pay via PayPal if you can help with this.


vbscript >> script for Robocopy

by Pegasus (MVP) » Fri, 23 May 2008 08:16:24 GMT

If you don't watch out then you might get killed in the stampede
for your PayPal fee . . .

This is a fairly simple job that several respondents are likely to
respond to, free of charge. Here is one solution as a starting point.

01. Const USB = 2
02. Set WshShell = CreateObject("WScript.Shell")
03. Set objSWbemServices = GetObject("winmgmts:\\.")
04. Set colSWbemObjectSet =
06. sDriveLetters = ""
07. For Each objSWbemObject In colSWbemObjectSet
08. If objSWbemObject.DriveType = USB Then
09. If UCase(objSWbemObject.VolumeName) = "TARGET" _
10. Then sTargetLetter = objSWbemObject.DeviceID _
11. Else sDriveLetters = sDriveLetters & objSWbemObject.DeviceID & " "
12. End If
13. Next
14. aDriveLetters = Split(sDriveLetters, " ")
16. For i = 0 To UBound(aDriveLetters) - 1
17. command = "robocopy.exe /r:1 /w:1 /s " & aDriveLetters(i) & "\ " _
18. & sTargetLetter & "\Drive" & Left(aDriveLetters(i), 1) & " *.*"
19. WshShell.Run command, 1, True
20. Next

vbscript >> script for Robocopy

by Pegasus (MVP) » Wed, 28 May 2008 13:17:24 GMT

I never thought that payment for this simple script would be
appropriate but a little "Thank you" for the free solution would
have been well received.

Similar Threads

1. Help with Robocopy/Laptop backup script

2. using robocopy in a script

Hi Folks,

I have a list of XP desktops in a text file (complist.txt) that I need
to copy a file to.  The file iManO2k.dot needs to replace the older
file on each desktop.  My problem is that using REPLACE I'm running
into an argument issue as the file is in \Program Files.  Is there a
clever way I can copy the file to each machine, while maintaining my
robocopy logs?

Any help would be appreciated.

3. Exclude Files when using robocopy

4. is a robocopy graphical progress bar possible?

So, how long has this tool been included with Windows?

I found it while looking for a very simple way to sync data between a local 
'My Documents' folder and a network backup location (for laptop users that 
need their data on their PC at all times).

I'm using a very simple... ROBOCOPY source destination /MIR /PURGE

Now, I'd like to be able to include some sort of graphical window for my 
users.  Something with a, "Please wait while your data is synchronized" and 
a progress bar that shows the user approximately how much time remains.  Any 
idea how I could do this?  Maybe getting a list of what needs to be copied 
first, then starting the copy?  Any help would be greatly appreciated.  I've 
dabbled in vb code before, but very little.

Posted 'as is'.  If there are any spelling and/or grammar mistakes, they 
were a direct result of my fingers and brain not being synchronized or my 
lack of caffeine.

Mike Brearley

5. robocopy do not write log files to UNc path

6. robocopy help needed

Hi All,
sorry for being offline but i need to know from where can i download
the latest version of robocopy i.e v1.96 for windows NT.
i've been trying to get it but unsuccessful till now.
Your help is highly appreciated.

7. Script within script - nesting scripts

8. vb script called from login script exits when login script termina

We're in the process of moving from Novell NetWare to MS servers for file & 
print sharing.  I'm working on some things related to the login script.

We want our overall login vb script to run "synchronously" with login so the 
user doesn't get their Windows desktop until after the main login script is 
finished.  This is working as expected.

However, we have a few things that we want to kick off from the login 
script, but not hold up the login process for.  So we have the following line 
in the main login script that calls another vb script with the "False" 
parameter to tell the scripting engine to not bother to wait until the called 
script returns before continuing.  Thus the main login script ends, the end 
user gets their Windows desktop and can begin working, but this new script is 
supposed to keep running in the background doing some things.

'Call the Asynchronous script
wshShell.Run "R:\Scripts\LoginAsync.vbs", 0, False

The problem is that it doesn't.  The async script launches but as soon as 
the main login script terminates, so does my called async script.  If I run 
the main login script manually it works as expected (the async script 
continues to run even after the main script terminates) but when we assign 
the main script to the GPO to make it a login script, it no longer works.

Why won't my async script continue to run after the main script exits when 
we set the main script as a GPO based login script?

Thank you.