https://superuser.com/questions/482112/using-robocopy-and-excluding-multiple-directories
robocopy N: S:\ /MIR /Z /LOG:S:\robo.log /XF pagefile.sys N:\BNA\Century.ccf 
rem /XF *.iso *.log *.au /XD G:\dir1 ...

robocopy N: S:\ /XO /S /Z /B /W:2 /R:2 /LOG:S:\robo.log /XF pagefile.sys N:\BNA\Century.ccf "N:\BSA\Audits\FDIC Audit 2013\16.1 Name & Title.docx"



I figured it out with a little trial and error and the /L (to test the command before doing it for real). The command I end up with is:

robocopy G: C:\backup /MIR /XD G:\dir1 "G:\dir 2" G:\dir3 ...

Apparently, including trailing slashes keeps robocopy from parsing the list of directories correctly, so be sure not to include trailing slashes on directory names and remember to put quotes around directories with spaces in the name.

The /MIR option maintains the same directory structure while copying the files.

Edit: After some more research, I improved the command a bit:

robocopy G: C:\backup /MIR /Z /LOG:C:\todaysdate-backup.log /XF *.iso *.log *.au /XD G:\dir1 ...

The additions are as follows:

    /Z allows the job to be restarted
    /LOG:<logfile path> is pretty self-explanatory.
    /XF is being used to exclude certain filetypes so it doesn't take so long

=====================================
https://serverfault.com/questions/444383/can-robocopy-be-made-to-skip-open-files
Thanks to pauska for the suggestion of the /B switch (backup mode). This tries to reset the archive bit on the file and so fails when the file is open. A combination of /B and /R /W is what worked for me in the end: 
robocopy ./test2 ./test1 /B /W:0 /R:0 

