soze (2nd June 2008)
I'm trying to backup the entire C drive to an external USB drive using Robocopy, what would the correct syntax be:
robocopy "C:\*.*" "D:\BackupFolder" /E /V /NP /ZB /R:10 /W:30
doesn't seem to be working.
Robocopy "C:\" "D:\BackupFolder" /MIR
should do it, but add your timeouts to it.
soze (2nd June 2008)

Quackers is right, that should work. Here's a good reference of all command switches.
As far as I can it's the "C:\*.*" which is incorrect.
Michael's right about the "*.*" being the problem - robocopy copies all files in the folder; you can't use it to (say) copy just the *.doc files.
What you can do is exclude some files - /XF *.bak *.tmp will exclude .bak and .tmp files
May not matter for what you're doing but I always include /sec to copy the security on files.
soze (2nd June 2008)
Thanks for the quick response guys, removed the *.* and the quotes and everything worked.
Would any of you be familiar with the Auto Run command, I would like for this Robocopy string to be executed when a external USB drive is inserted into the machine with no user interaction.
Thanks for all the Help!![]()

For anyone who isn't the best with the commands this might help
Utility Spotlight: Robocopy GUI
soze (2nd June 2008)

I don't think Robocopy can be automated as far as that, but the easiest method would be to create a batch file and schedule it to run at 6pm for example, by which time you or someone would of plugged in a USB drive.
Alternatively, you could just create a shortcut on your desktop and double click it once the USB drive has been connected.

I wonder if you could make a VBS script that works in the background. Say drive letter “G” is occupied it will copy the contents to a folder.

That would make sense. Not sure how difficult a script it would be though!I wonder if you could make a VBS script that works in the background. Say drive letter “G” is occupied it will copy the contents to a folder.

It would be tricky, but i can give it a bash.
soze (2nd June 2008)
Attached is a zip file containing a hastily cobbled together AutoIt script and INI file that will watch for the arrival of a particular drive letter. When detected, a simple directory copy (with forced overwrite) will take place and the script then waits for the drive to disappear before returning to its original wait mode. It's had very limited testing but seems to work OK.
soze (2nd June 2008)
another alternative is to use WMI. This can set up somethng called an event sink which sits there waiting for an event to happen. When it does, you carry out a particular action.
The attached script will do just that. run it (best to use wscript because otherwise you'll see a window on screen) and it will sit in the background waiting.
When a USB stick is inserted, the sink event will trigger. I wrote this for something else (question here about how to check for "bad" files on a USB stick) but it's easy to adapt. Basically, when the USB device arrives it gets given a DEVICEID; this is used to find out more info about the drive including its name (not C: etc but things like harddisk0). This is then queried using WMI to get a list of partitions (USB sticks often have more than one partition)
finally, the routine CheckFolder is called once for each partition - it's called with the drive letter and a backslash - eg G:\
In that routine you could add something like:
This will copy the contents of the partition to c:\backup - you can obviously put it where you want!Code:Set oShell=createobject("wscript.shell") sCmd="robocopy " & sFolder & " c:\backup /s /e" oShell.run sCmd,7,true
soze (2nd June 2008)

Nice one, when "thanks" work again i will give you one for that.
soze (2nd June 2008)
There are currently 1 users browsing this thread. (0 members and 1 guests)