Solved

Robocopy Script with Destination Folder Name Change

Posted on 2015-02-04
7
634 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
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 walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

828 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