Solved

Robocopy Script with Destination Folder Name Change

Posted on 2015-02-04
7
582 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

813 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

10 Experts available now in Live!

Get 1:1 Help Now