Link to home
Start Free TrialLog in
Avatar of shconsultancy
shconsultancy

asked on

script to copy a file from one location to another

I have pst files in user folders that I need to move to another shared area on the same server. I need a vbs/cmd/batch file to run this.
The folder structure is as follows:
\\server1\userarchive\user initials\notes_user initials.pst and I need it to go to \\server1\userdata\user initials\_notes archive
There are a few hundred users that this will need to go through.
There is only one .pst file in each user folder so *.pst will be fine in the script

Please help, very urgent

Steve
Avatar of Kragster
Kragster

For clarification given a example user with initials "abc"
you would have:
\\server1\userarchive\abc\notes_abc.pst
and want it to become
\\server1\userdata\abc\_notes archive\notes_abc.pst

is that right?
Avatar of shconsultancy

ASKER

Yes that is correct
Hi,
Yes you can use it to copy to network drives

Robocopy is a microsoft tool which many IT adminsitrators use to copy

http://www.ss64.com/nt/robocopy.html

The above link will give you a good start.
Yes but will Robocopy loop through all of the hundreds of user folders to do what I ask it to?
ASKER CERTIFIED SOLUTION
Avatar of Kragster
Kragster

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
copy \\server1\userarchive\%USERNAME%\notes_user initials.pst  \\server1\userdata\%USERNAME%\_notes archive\

:# is this what you mean?
One problem with my solution I just noticed is that it copies and you said move.  You can change the line that says....

objFSO.CopyFile tempSource, tempDest
to
objFSO.MoveFile tempSource, tempDest

Excellent, just what I was looking for. I managed to change the Copy to Move before you sent the message.

Superb service

Steve