Robocopy Script with Destination Folder Name Change

I'm performing a robocopy of user home folders from a separate company. The source folder names are in a different name format than the destination folder names. The source home folders are located in a folder called "userdata".  The destination home folders are located in a folder called "home".

I am looking for a way to better automate the process, rather then having 200 separate robocopy commands for each home folder.

Is there a way to copy the entire source root folder "userdata" to the destination folder "home" while specifying the different folder name?
 Or:
Is there a way to script the robocopy operation so that I can either have the 200 robocopy commands in a file and the process will automatically go through each one in sequential order?

My other thought is to just copy the source named folder as is to the destination, then rename the folders once completed, although this would still be a manual process and I would have to update the home folder path for each user.

It wouldn't be feasible for me to rename the source folder names as, we are constantly getting updated data and I wouldn't want to alter any timestamps of the source data.

Any help and suggestions are appreciated.
LVL 1
fireguy1125Asked:
Who is Participating?
 
QlemoConnect With a Mentor Batchelor and DeveloperCommented:
for /d %%D in (c:\userdata\*) do robocopy "%%~D" "D:\home\%%~nxD" /s

Open in new window

In a batch file should do that. Replace paths and options as appropriate, of course, the above is figurative only.
0
 
Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
Is the source root folder "Root" and you have all the contents there and the Home is the desitnation root where yu want to to copy the contents of root folder to?

I don't seem to understand what you are trying to achieve.

Regards

Robocopy <source> <destination> /MIR
0
 
NVITCommented:
Can you clarify how you want to end result?
Do you want it to look like: \\server1\userdata\user1 folder to \\server2\home\user1
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
NVITConnect With a Mentor Commented:
...wouldn't want to alter any timestamps
Be sure to use the robocopy /DCOPY:T switch to maintain folder timestamps
0
 
QlemoBatchelor and DeveloperCommented:
The accepted comment isn't the sole solution for sure. There should have been  a split.
0
 
NVITCommented:
@Qlemo.
Yeah. IDK why OP decided that way. Is there recourse, since already closed? My post seemed supplemental
0
 
QlemoBatchelor and DeveloperCommented:
Closing suggestion:
  http:#a40589330   400
  http:#a40589342  100
0
All Courses

From novice to tech pro — start learning today.