Fixed: Why is robocopy changing my folder names and icons?!

 I just worked a real head-scratcher with a customer.  They're doing a data migration of user home directories to a new NAS and using robocopy to copy the data from the old server to the new server.  This is basic stuff we've done a million times.  The only wrinkles are we're changing the folder names to match the user's usernames in a new domain and updating the permissions.

This bit is important: We expect \\oldserver\users\JDoe will copy to \\newserver\users\JohnDoe

We've already created the JohnDoe folder on the new server and set the proper permissions.  We just need the robocopy command to copy over the files and folders *without* the old security ACLS.  Easy enough. 

The Robocopy command for this
Robocopy \\oldserver\users\JDoe \\newserver\users\JohnDoe /e /zb /copy:DAT

/e - Copy subdirectories, even empty ones
/zb - Copy in restartable mode, using backup privileges if necessary
/copy:DAT - Copy the Data, Attributes (e.g. Hidden/System/Archive/Read Only), and Timestamps

The copy zips right along and we're all good, right?

No.

Opening \\newserver\users, I see the folder JDoe.  

That's weird.  I must have typed it wrong in the batch file, right?
No, it's right.

Is it a gremlin?  If I disconnect and reconnect the network drive and restart explorer?
No, still JDoe.

No, it's not a junction point either, and opening the folder-which-should-not-exist puts me in the proper folder \\newserver\users\JohnDoe.

What in the baked beans and sweet potatoes is this tomfoolery?  Is it time to break out the Ouija board?

The cause, which took a bit to figure out, was Windows Explorer's folder localization feature.  This uses a hidden+system file named desktop.ini to specify options like the folder icon and localized name of the folder.  These user folders all contained desktop.ini files that localized the folder name to the old username and removing or renaming the desktop.ini file to something else fixed it.

That's a great way to start a Thursday.

Comments