Montag, 13. August 2012 22:28
I have created a script to move home folders using Robocopy, on a Win 2008 R2 64bit server. All our file servers are Win 2k8 R2 64bit.
The approach I have to move them effectively is as follows:
1) Create \\FileServerB\ServerB$\User1 (this is the destination)
2) Set Permissions on the above folder
3) Run Robocopy \\FileServerA\ServerA$\User1 \\FileServerB\ServerB$\User1 /MIR /COPY:DATOU /MOVE /R:1 /W:1 /MT:128 /LOG+MyLog.log
It does a pretty good job in copying the files and folders (and subfolders), however, while I assume the source folder will be deleted, it actually behaves like this:
1) If the source folder does not have subfolders, itself will be deleted after being copied.
2) If the source folder contains subfolders, only files will be deleted. So in the end it leaves the original empty folder structure in the source.
Is this the expected behaviour of the /MOVE switch?? I try not to add an RD \\FileServerA\ServerA$\User1 /s /q statement after that, in case if something goes wrong with that Robocopy instance, the source will not be deleted.
So what is the correct syntax/approach to achieve a clean and "robust" move of folders?
Dienstag, 14. August 2012 06:07
Yes, What you are seeing is a expected behavior. And its by design.
Using Robocopy to Move Files and Folders
If you found this post helpful, please give it a "Helpful" vote.
If it answered your question, remember to mark it as an "Answer".
This posting is provided "AS IS" with no warranties and confers no rights! Always test ANY suggestion in a test environment before implementing!
- Als Antwort markiert Shaon ShanMicrosoft Contingent Staff, Moderator Mittwoch, 15. August 2012 06:17
Sonntag, 9. Dezember 2012 04:35
If I'm reading his blogs correctly, he is saying he was using the /MOV switch (move files) with an option for recursion, and so had to run a script afterwards to remove empty directories. He then said he found /MOVE, which made his cleanup script unnecessary, since /MOVE will move files and folders (again, needing to use the option to recurse).
I am also seeing the same behavior as the OP - /MOVE is leaving some folders behind. It will delete folders that were already empty from the source. If a folder had contents, it will correctly move the file, but not delete the folder from source.
Sonntag, 9. Dezember 2012 20:01After some playing around, /MOVE behaves as expected if the /mt flag is not used - using it will leave empty folders behind