Solved xcopy batch scripting help

June 25, 2013 at 13:10:46
Specs: Windows server
Hi all I have 6000 users with new username and new homedir location and have to copy all data from old username homedir, to new username homedir with new file location, all usernames is in a text file with old username and new username separated with tab on each line, can anyone please help ?

See More: xcopy batch scripting help

Report •


#1
June 25, 2013 at 19:25:44
✔ Best Answer
I can't help you much, but maybe except for reading the tab-delim file:
@echo off & setlocal
set tab=
for /f "tokens=1,2 delims=%tab%" in (list.tab) do echo xcopy /s %home%\%%a %home%\%%b
::==== end snippet

i don't know where %home% comes from, so I just left it at that.
Since I'm assuming spaces are included in the data, I had to set the delims to TAB (char(9)). Maybe there's a better way to do it, but I had to use a literal TAB in the batch-script (using alt-009 or ctrl-P to insert it into the code). Use EDIT or NOTEPAD to insert a tab at end of line two ("set tab="). It must be a true TAB and not spaces.

Report •

#2
June 26, 2013 at 01:23:54
Post a few lines of the file and maybe something can be done.

=====================
M2 Golden-Triangle


Report •

#3
June 26, 2013 at 10:06:07
Hi nbrane thanks for quick response but when i run it,reading the tab-delim file not working, can you tell me, how I can get the result from reading the file on screen

Report •

Related Solutions

#4
June 26, 2013 at 10:13:48
Can you give us a couple lines of the "list.tab" file? Thanks.

P.S.

I do not know what "%home%" is. This is not a system variable I recognize. It could be you are setting it like:

set home "c:\"

Is there more code that we are missing?


Report •

#5
June 26, 2013 at 11:21:28
I have reservations about this endeavor.
Where are these home directories now, and where are they going? For what purpose are you moving them?
Are you scrubbing their user registry information, and updating any references to the old home with the new?
Are the user's SIDs changing? If so, what are you doing to resolve the discrepancy?

ace_omega, Home-Directory is an Active Directory attribute. It either specifies a local path, or it's used in conjunction with the Home-Drive attribute to specify a network share that's mapped when the user logs in.

How To Ask Questions The Smart Way


Report •

#6
June 27, 2013 at 11:25:22
Hi all Now it works :)
@echo off
For /F "tokens=1,2 delims= " %%i in (M:\Dokumenter\Xcopy_commands\unifilelist.txt) do xcopy /c /h /s /e \\nbufil01\profiler$\brugere\%%i \\nbufil01\profiler$\unielever\%%j
::==== end snippet

(Theres a true TAB after delims= )


Report •

#7
June 27, 2013 at 11:37:59
Not seeing a /O or /X switch. That might cause issues with the users.

How To Ask Questions The Smart Way


Report •


Ask Question