Click here for important information about

I need some help please

Microsoft Windows server 2008 standard -...
May 6, 2010 at 00:35:46
Specs: Windows XP
I need to archieve some user's home \\SvrA\archives$\Users\Homes\%username% to another location \\svrA\\\dumbledore\archives$\Users\Homes\%username%. I have the list of 200 users in a CSV form.

I am not a scripter, only know how to use dos command to do some stuff

See More: I need some help please

May 6, 2010 at 06:50:24
Why script?

Back them up and restore them to the new location.

Doesn't get simplier than that.

Though you will need to correct this path

Report •

May 6, 2010 at 23:21:55
Thanks. The reasons I can't just back them up iand restore them to another location is that I have 300 out of 550 folders to archive. That means, I have to search for individual folders, mark them for backups. Actually, I was able to use xcopy to make it faster, but I want a batch file to select the names from the list.

xcopy \\Server A\homes$\Homes\first.last \\dumbledore\archives$\Users\Homes\first.last /s /h /c /f

I tried to use %username% for first.lastname, but still need it to select this from the list.

I will appreciate any help in this regard

Report •

May 6, 2010 at 23:33:15
Let me be clear here. I have a list of users who have left the company. I have the list of these users that need their folders to be archived from the Home Directory to another location.

So what I need is a batch file that will move them from Home Directory to Archive Directory with their usernames.

Report •

Related Solutions

May 7, 2010 at 09:18:53
It may help to post a few lines of your list.

Helping others achieve escape felicity


Report •

May 7, 2010 at 13:34:50
it just needs minor alterations in that case:

@echo off & setlocal
for /f "tokens=*" %%a in (file.csv) do (
echo backing up user: %%a
xcopy \\ServerA\homes$\Homes\users\%%a \\ServerA\archives$\Users\Homes\%%a /s /h /c /f

Report •

May 8, 2010 at 00:45:46

Thanks for your contribution. I think I made a mistake presenting the structure of my data. From csv file, I have extracted only one column that I needed which is Firstname.Lastname which is used for creating Home directory.

Here is the case. I have extracted a list of usernames that left the company like this in one column

The home directories are listed like this:

I need to move them to another location like this:

What I am looking for is a move process to read from the list and execute. I hope this makes it clear. I tried the your script, but it did not work because I gave you wrong info regarding the nature of the list.

Report •

May 8, 2010 at 10:01:12
see if modified resp #5 works.

Report •

May 9, 2010 at 22:45:29
Thanks Nbrane. This is the error I got when I ran it in vbs:

Line: 1
Char: 1
Error: Invalide character
Code: 800A0408
Source: Microsoft VBScript compilation error:

When I tried it on command line, this is what I got.

And this is what I got when I issued the command on command line:

C:\Program Files\Windows Resource Kits\Tools>cd\movetest

C:\movetest>@echo off & setlocal
for /f "tokens=*" %%a in (movetest.txt) do (
%%a was unexpected at this time.
echo backing up user: %%a
backing up user: %%a
xcopy \\ServerA\homes$\Homes\users\%%a \\ServerB\archives$\Users\Homes\%%a /s /h /c /f
File not found - %%a
0 File(s) copied

I copied movetes.txt and in a seperate folder called movetest and change to that directory on command line before issueing the command.
I think I need to take some intro in VBS Class.

Report •

May 10, 2010 at 10:39:19
well, both of your bullets missed the target!
the code i gave was batch script, not vbs which is
another language entirely.
and being a script, the code needs to be "enscripted":
it is meant to be run from a script (text) file with a .bat
extension, invoked from the commandline.
if you cut/paste #5 to notepad, then save as (f/e) c:\test.bat,
then from commandline, type: c:\test
the command might run.
You might need to get more help than i can give since you
don't have much experience with batch script.
from commandprompt, type these:
for /?
if /?
set /?
to get an idea.

Report •

May 11, 2010 at 04:57:45
Nbrane, you are supper!!
I have understanding of basic Dos command. I did not know it was bat file you wanted me to use. When I ran it the first time, it copied (0) files and prompted me for either File or Directory. I then removed %% after Homes to read:
archives$\Users\Homes\ /S /H /C /E. It worked very well.

@echo off & setlocal
for /f "tokens=*" %%a in (file.csv) do (
echo backing up user: %%a
xcopy \\ServerA\homes$\Homes\users\%%a \\ServerA\archives$\Users\Homes\%%a /s /h /c /f

Now, by any chance is there any way I can incorporate MOVE command to this batch script?

Once again, thanks you!!!

Report •

May 11, 2010 at 07:07:00
Thanks. I corrected myself in the above posting and the final correct one now is this.

@echo off & setlocal
for /f "tokens=*" %%a in (file.csv) do (
echo backing up user: %%a
xcopy \\ServerA\homes$\Homes\%%a \\Serverb\archives$\Users\Homes\%%a /H /C /E /I /y

Report •

May 11, 2010 at 13:35:36
"Now, by any chance is there any way I can incorporate MOVE command to this batch script?"

unfort. xcopy doesn't have a DEL-AFTER-COPY option.
inside the for-loop, (AFTER the xcopy of course), you could
rd /s \\ServerA\homes$\Homes\%%a

but be very careful testing, since it's a destructive command!
(use echos and pauses etc. till tested)

Report •

May 12, 2010 at 00:31:48
Nbrane, you have been a Life Savior. The #5 saved me many days of work. I used to write MS-Dos /Apple Soft to create different (Math, Spellings, etc) programs for elementary school as a computer teacher 15 years ago until the processor changed from 286 to X386. How wonderful to compare then to you the new generations of nowadays.

I have not tested the new delete option. I will certainly write to thank you for it, whether it works or not.

Thank you a million times.

Report •

Ask Question