Copying direcoties into user directories

I need a script that will copy a directory and it's sub-directory into the home directory of hundreds of users.  For example, the script needs to copy the directories WORK\FAV into the g:\AJones, g:\BPeters, and g:\CSmith directories, and finish up with g:\ZWilliams at the end.  Preferably, I won't have to type every username into the script.

I realize this would be an easy task if each user ran an XCOPY during the login script but that's not an option at the moment.  Is there another way to do this?
cjones3rdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
So, can you do this on the g: server, or a system that has access to it?  And if so, is it okay to copy the folders into every top level folder on g:?

Where is work\fav located?

~bp
0
cjones3rdAuthor Commented:
Yes.  I can run the script (DOS batch file) on the server and it is ok to copy work\fav into every top level folder under g:.  They are all user home directories.  

The work\fav directories are located in:  \\svr1\users\Admin\CourtForms
0
Bill PrewCommented:
Okay, here's a first shot.  Feel free to add other options to the XCOPY command if needed. This will not do the copy right now, just display the folders that would be copied.  If that looks good, then remove the REM before the XCOPY and run for real.

@echo off

set UserDir=J:
set FromDir=\\svr1\users\Admin\CourtForms
set CopyDir=work\fav

for /d %%A in ("%UserDir%\*.*") do (
  echo Copying "%FromDir%\%CopyDir%\*.*" to "%UserDir%\%%~A\%CopyDir%\"
  REM xcopy /s /i "%FromDir%\%CopyDir%\*.*" "%UserDir%\%%~A\%CopyDir%\"
)

Open in new window

~bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cjones3rdAuthor Commented:
Thank you!  I will test and let you know
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.