?
Solved

Script to Copy Folder and Sub-Folders and Files To All Users

Posted on 2010-01-11
8
Medium Priority
?
294 Views
Last Modified: 2013-11-10
Hello Experts,

I am wondering if there is a easy way to copy folders and sub-folders to all user accounts in Windows XP except Administrator, Default User, All Users, LocalService, NetworkService.

I have users that share computers that I need to copy a set of files via folder.

The contents is located in C:\_CONTENT
The sub-folders are C:\CONTENT\WEBFORMS & C:\CONTENT\SALESFORMS

I know I can copy to all user accounts by using the Default User account but I would like to not copy Administrator, Default User, All Users, LocalService, NetworkService accounts.

Can someone help me I do not really know how to program.
0
Comment
Question by:katredrum
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 16

Expert Comment

by:Raheem05
ID: 26287675
Katredrum,

Are these users domain users? Would if not be easier setting a share and giving them rights to this share as a mapped drive?

Unless a program needs these files to run locally?
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 26287676
Where in each users files do you want the copied in files to reside?  Meaning do you want:

c:\_content -> c:\documents and settings\user1\_content

Or do you want it in their My Documents?  Do you actually want the _content directory, or just the 2 subfolders in each user?

~bp
0
 
LVL 66

Expert Comment

by:johnb6767
ID: 26288037
Or, at minimum, just give them a Desktop shortcut if you dont want to put it on the network as a share.....
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 38

Expert Comment

by:Shift-3
ID: 26288055
As others have pointed out, it would make more sense to use a network share or copy the files under the All Users profile.  However, if you really wanted to copy them under each individual user's profile, here is a way.

Paste the script below into a text file with a .cmd extension.  Customize the value of the dest variable on line 5 with the location under each user's profile to copy the files to.  Running the script will echo the commands to be run.  Once you have tested it successfully and are certain it will do what you intend, remove the word ECHO from line 9 to copy the files.  Any existing files will be overwritten.


@echo off
setlocal
 
set source=C:\_CONTENT
set dest=My Documents\CONTENT
set filter=/C:"All Users" /C:"Default User" /C:"LocalService" /C:"NetworkService"
 
for /F "tokens=*" %%G in ('dir "%allusersprofile%\.." /A:D /B^| findstr /I /V %filter%') do (
 ECHO xcopy "%source%\*.*" "%allusersprofile%\..\%%G\%dest%\" C /H /R /Y
)
 
pause

Open in new window

0
 
LVL 66

Expert Comment

by:johnb6767
ID: 26288167
Reason for the Network Share/Desktop Shortcut, is that you dont want multiple copies of files all over user profiles. You need 1 folder with the files, and all users should only POINT to it, so there is a single spot for storage....
0
 
LVL 38

Accepted Solution

by:
Shift-3 earned 2000 total points
ID: 26288388
Correction.


@echo off
setlocal
 
set source=C:\_CONTENT
set dest=My Documents\CONTENT
set filter=/C:"All Users" /C:"Default User" /C:"LocalService" /C:"NetworkService"
 
for /F "tokens=*" %%G in ('dir "%allusersprofile%\.." /A:D /B^| findstr /I /V %filter%') do (
 ECHO xcopy "%source%\*.*" "%allusersprofile%\..\%%G\%dest%\" /E /C /H /R /Y
)
 
pause

Open in new window

0
 
LVL 1

Author Comment

by:katredrum
ID: 26288824
Thanks everyone who replied. I know having multiple files for each profile is not good practice but we are trying to keep brand new files for everyone that logs in to eliminate any unequal opportunity. I will try the script and will let you know.
0
 
LVL 1

Author Closing Comment

by:katredrum
ID: 31675753
Perfecto! Thank you very much!
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Introduction to Processes

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question