Link to home
Start Free TrialLog in
Avatar of quippee

asked on

copy script from userlist

Hello experts, I would liek to copy files from the user profiles to another folder where the user has another folder.

for exampple for user lisa

copy c:\profiles\list\*.*   d:\backup\lisa\

for one user is not problem, but i have a a list of users  in  a text file and I was wondering if there is a way to use that list to inser it in the username part. something like this

copy c:\profiles\%username%\*.*  d:\backup\%username%   Where the username is picked from a list and then it moves to the next.

Im sure there is a way. Just that im not an expert :)
Avatar of TG Tran
TG Tran
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of quippee


Thanks that worked. but I also used powershell. which was a lil better for now.

example to move documents

$a = get-content c:\users.txt
foreach ($i in $a)
{move-item "Z:\profiles\$i\My documents" "z:\profles2\home\$i\"}