Re: Script to Copy multiple folders from one Server to another



Seeing that your current method is already based on robocopy.exe,
a batch file might be the most appropriate solution. The code below
relies on the following assumptions:
- It is invoked on the target server.
- The target folder names are identical to the users' account names.
- The users' account names contain the old folder names in the
"Comment Field".

You need ot adjust Lines #1 and #2 to suit your environment.
You should then run the batch file as it is (after removing the
line numbers). When you're happy with the result, remove the
word "echo" in line 13.
01. @echo off
02. set Source=\\OldServer\User Files
03. set Target=D:\User Data
04.
05. cd /d "%Target%"
06. for /d %%a in (*.*) do call :Sub %%a
07. goto :eof
08.
09. :Sub
10. echo Processing %*
11. for /F "delims=" %%a in ('net user "%*" ^| find "Comment"') do set
Line=%%a
12. set ID=%Line:~29%
13. echo robocopy /s "%Source%\%ID%" "%Target%\%*" *.*

"Elvis" <Elvis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2498C0C4-1A43-4EF8-A3F9-4BAA15ACBBEE@xxxxxxxxxxxxxxxx
Hi Pegasus,

Could you give me an example of the code I would need. I appreciate the
help
below, an example is easier for me to modify.
So to clarify, this will copy the source folders to the target Server
based
on AD description field.
Much appreciated,

Thanks

"Pegasus (MVP)" wrote:

You could use the CopyFolder method of the File System Object
to copy the source folders to the target server. To determine the
target folder name from the Description field, use this code:

Set objSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://"; & objSysInfo.UserName)
WScript.Echo objUser.Description


"Elvis" <Elvis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B0945406-7ED2-459E-9D07-E72A9F352D82@xxxxxxxxxxxxxxxx
Hi,

Thanks for a quick response,
The target folder names are the same as the login names.
The company id folder names on the source will be the same as the
description field of each active directory user on the target.

Thanks

Elvis

"Pegasus (MVP)" wrote:


"Elvis" <Elvis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:15D8C536-B73E-4D08-A1F8-1888EB23F436@xxxxxxxxxxxxxxxx
Hi,

I am a very basic scriptor and I require a little help.
I am trying to accomplish the following
Copy home directories from one Server to another on different
Operating
systems.
The target is Windows 2003 Server.
The home directories on the source Server have a home directory
structure
where the folders names are based on Company ID numbers.
The target home folder structure uses first name and last name as
folder
names.
I am not interested in maintaining security as the home directories
on
the
Microsoft Server have already been configured with security and the
migrated
files will inherit.
I have used Robocopy in basic copying but what is required to
accomplish
this task as I have over 500 folders to move.
The problem I am having is how do I get the home directories with
different
home folder naming conventions to copy to the correct home folders
on
the
target?
I would like to use Robocopy if possible??
Any help is greatly appreciated,
Thanks

Elvis

How do you translate Company ID numbers to First/Last names?








.



Relevant Pages

  • Re: create folder in public folders using Exchange SDK and C#
    ... installing setUp of my program to register this eventsink on the target ... copied this on the target server and then start the com ... folder is deleted or inserted in the public mail folders. ...
    (microsoft.public.exchange2000.development)
  • Re: My Documents
    ... What and where you really need to do this is using the SMS Server Mangement ... Go to Users and in the Manage Users area you will see the ... on the Target tab you do not see "Target location ... folder" with the 3 option buttons. ...
    (microsoft.public.windows.server.sbs)
  • Re: Script to Copy multiple folders from one Server to another
    ... The target folder names are identical to the users' account names. ... this will copy the source folders to the target Server ... The home directories on the source Server have a home directory ...
    (microsoft.public.scripting.wsh)
  • Re: ABE in a DFS Environment
    ... Yes, right click the root in the DFS management, and then add new link. ... > I understand that you installed ABE on both SBS 2K3 Server and Windows ... did you access the shared folder by ... > root target you created and select New Link? ...
    (microsoft.public.windows.server.sbs)
  • Re: Stuck on Permissions
    ... Can you assign them home directories in ADUC? ... server, higlight all of the users in AD and modify their User Home ... We've recently run into the issue where students have been deleting ... another folder, and I spend a significant amount of time undeleting ...
    (microsoft.public.windows.server.general)