Re: Script to Copy multiple folders from one Server to another
- From: "Pegasus \(MVP\)" <I.can@xxxxxxxxxx>
- Date: Wed, 11 Jun 2008 19:31:07 +0200
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?
.
- Follow-Ups:
- References:
- Script to Copy multiple folders from one Server to another
- From: Elvis
- Re: Script to Copy multiple folders from one Server to another
- From: Pegasus \(MVP\)
- Re: Script to Copy multiple folders from one Server to another
- From: Pegasus \(MVP\)
- Re: Script to Copy multiple folders from one Server to another
- From: Elvis
- Script to Copy multiple folders from one Server to another
- Prev by Date: Re: How could I play a mp3 or wav file using WSH?
- Next by Date: Re: Script to Copy multiple folders from one Server to another
- Previous by thread: Re: Script to Copy multiple folders from one Server to another
- Next by thread: Re: Script to Copy multiple folders from one Server to another
- Index(es):
Relevant Pages
|