Solved

Robocopy Script with Destination Folder Name Change

Posted on 2015-02-04
7
665 Views
Last Modified: 2015-02-24
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.
0
Comment
Question by:fireguy1125
  • 3
  • 3
7 Comments
 
LVL 17

Expert Comment

by:Emmanuel Adebayo
ID: 40589322
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
 
LVL 69

Accepted Solution

by:
Qlemo earned 400 total points
ID: 40589330
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
 
LVL 24

Expert Comment

by:NVIT
ID: 40589332
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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 24

Assisted Solution

by:NVIT
NVIT earned 100 total points
ID: 40589342
...wouldn't want to alter any timestamps
Be sure to use the robocopy /DCOPY:T switch to maintain folder timestamps
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 40605404
The accepted comment isn't the sole solution for sure. There should have been  a split.
0
 
LVL 24

Expert Comment

by:NVIT
ID: 40606193
@Qlemo.
Yeah. IDK why OP decided that way. Is there recourse, since already closed? My post seemed supplemental
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 40624123
Closing suggestion:
  http:#a40589330   400
  http:#a40589342  100
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question