Does anybody have a script that would allow me to do the following quickly.
I have my current users My Documents as their home folder.
To accomidate Windows 7 and its annoying feature of renaming every home folder to "Documents", i have decided to alter the structure.
So i will have E:\Homes\%username%\My Documents instead.
I am also moving it from 1 server to another.
So i could do with a quick way of moving them. Say i map Y: as the new servers Homes folder during this process.
E:\Homes\User\ to Y:\Homes\User\My Documents
Hope that makes sense!
Code:move e:\homes e:\homestemp md e:\homes cd e:\homestemp for /d %i in (*) do md e:\homes\%i & ren %i "my documents" & move "my documents" e:\homes\%i
Do make sure you've got a good backup! I've tried this on 2 folders and it works fine but I had just created them and the permissions were "correct" etc etc. If you replace the * in the final line with (say) z* then you'll only move usernames beginning with Z so you get a chance to be confident.
When you do the md e:\homes step you might want to add a cacls line to set the permissions properly at the top level. The next step shouldn't need permissions changing - you're moving so the permissions will move with them.
Note that this is written as a set of lines to type at the command prompt. If you put them in a batch file you need to double up the % signs (so %%i instead of %i)
@mac_shinobi; - I don't think robocopy will work (I did think about it; generally for questions containing the words "move home directories" the answer is "robocopy" but I can't see how to move stuff into a sub-directory of itself hence the convoluted swap I've used. Happy to be proved wrong :-)
Quackers (22nd August 2010)
There are currently 1 users browsing this thread. (0 members and 1 guests)