Robocopy is a pretty good utility for copyin/mirroring directories in windows. I use it a lot. I just spent a bit of time thinking powershell hated robocopy because I was having a lot of trouble calling a robocopy against a directory that had a space in it. Check out this command line. Looks pretty innocent to me, but as you can see, robocopy blows its top!
PS H:\temp> robocopy 'h:\temp\test1' 'H:\temp\test space\' /L ------------------------------------------------------------------------------- ROBOCOPY :: Robust File Copy for Windows :: Version XP010 ------------------------------------------------------------------------------- Started : Wed Jan 28 09:43:27 2009 Source : h:\temp\test1\ Dest : H:\temp\test space" \L\ Files : *.* Options : *.* /COPY:DAT /R:1000000 /W:30 ------------------------------------------------------------------------------ 2009/01/28 09:43:27 ERROR 123 (0x0000007B) Accessing Destination Directory H:\temp\test space" \L\ The filename, directory name, or volume label syntax is incorrect. PS H:\temp></span> |
Turns out the trailing slash on the path that was making it freak out. Don’t end with a slash folks. I’m not even sure why I was because I normally don’t!