Solved

Robocopy Script with Destination Folder Name Change

Posted on 2015-02-04
7
511 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 16

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 68

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 23

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 23

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 68

Expert Comment

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

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 68

Expert Comment

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

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

How to update Firmware and Bios in Dell Equalogic PS6000 Arrays and Hard Disks firmware update.
Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now