ROBOCOPY creates empty directories when user running it does not have rights to a folder's contents
Hi,Just something for Microsoft or possible solution comment really...Logon script creates user Start Menu based on what rights they have on a networked master copy.ROBOCOPY.EXE is used for the copy like this:ROBOCOPY <source> <target> /MIR /MT /R:0This will create the Start Menu for the user on 1st logon, and the /MIR will update it on subseqent logons. It works well.Except for, /R:0 will immediately skip and continue if the user has no rights to a folder or it's contents. In this case, ROBOCOPY creates an empty folder which is quite annoying, regardless of other settings tried such as /S.Luckilly I have a small DLL of useful functions used by our logon scripts and one of these will remove all empty subdirectories from the specified directory so I can work around this.I can't find any combination of switches on ROBOCOPY to fix this, however, for example, XCOPY does not do this if a user has no rights to a folder.Any suggestions?!Thanks!Rob
November 27th, 2009 7:51am

Hi,According to my understanding, the switch /MIR is equivalent to /e+ /purge which includes the empty directories. While you configure the parameter /R:0thatspecifies the number of retries on failed copies to 0, the /MIR switch will create an empty folder so as to indicates that the copy process is completed including the empty directory. Thus I recommend you to configure the parameter /R:0 to /R:1 and see how it works.If I misunderstood, please feel free to let me know. Thanks.For references:RobocopyBest RegardsDale
Free Windows Admin Tool Kit Click here and download it now
November 27th, 2009 1:37pm

Thanks, Dale, I shall try this when back in the office next week. Just to be clear, the folders are not actually empty, they contain shortcuts. The user just has no access (not even read) to the folder or it's contents. In this case, as does xcopy, I would expect robocopy to simply ignore such a folder, not try to copy it and make an empty folder out of it...
November 28th, 2009 4:10am

Ah, setting /R:1 makes ROBOCOPY pause for 30 seconds at each no access point. So, I added /W:1 to make the pause 1 sec and it still makes empty folders. Also, it's takes much longer to run with /R:1, even when using /W:1.I've tried using /S /PURGE again (I already tried this before) and that makes empty folders, too.I'll keep playing with it for a while but it looks like we need a "don't create empty folders on access denied" switch...P.S. I have now also tried /XX & /XL with no luck. I will just have to live with it and carry on running my PruneFolders() function.
Free Windows Admin Tool Kit Click here and download it now
November 30th, 2009 12:24am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics