Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hey guys,
I'm looking for a script that i can use to copy network folders from one location to another. I am currently doing a migration which creates a folder inside our user share as a .V2, and needs the files/folders to be placed in this new location for the app to see them:
 
\\server\user\"user's folder"
 
"User's folder" contains Profile & Profile.V2
 
What I'm looking for is a script that i can pipe in values (in this case usernames) so it will run through the list making the changes.
 
Basically, everything from the "Profile" directory needs to be copied to "Profile.V2"
 
i was thinking about using a CSV to pipe in values so that i can do something like:
 
User 01
User 02
User 03
 
and then have the script go to:
 
\\server\user\User01\Profile
 
and copy the contents to
 
\\server\user\User01\Profile.V2
 
i would then like the script to continue on to 02, 03, ect...
 
If anyone has a script that would do this, or any suggestions/help I would really appreciate it!!!!
 
Thanks,
Doug
Posted 27-Mar-12 12:07pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

xcopy.exe is definitely your friend here. It's built into Windows, so it's cost is nothing. some of the options we also add include these:
 
•/s/e - recursive copy, including copying empty directories.
•/v - add this to verify the copy against the original. slower, but for the paranoid.
•/h - copy system and hidden files.
•/k - copy read-only attributes along with files. otherwise, all files become read-write.
•/x - if you care about permissions, you might want /o or /x.
•/y - don't prompt before overwriting existing files.
•/z - if you think the copy might fail and you want to restart it, use this. It places a marker on each file as it copies, so you can rerun the xcopy command to pick up from where it left off.
 
Recommended batch script is:
 
xcopy /s/z sourcefolder targetfolder
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Thanks for the quick response. I was thinking on using xcopy or robocopy, but the only issue i have with either is automation. I have around 500 users that need to have files copied as mentioned above. Another catch with this is that they must have already logged into the new environment which in turn creates the Profile.V2 folder.
 
My thoughts on this were either to:
 
-build in some kind of error catch where the script checks for the .V2 folder. If there run the copy, and if not skip the copy and maybe list the folder name
 
-have the script run off of a CSV list where i can manually enter the user accounts and have it run that way.
 
Thoughts?
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 410
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 264
3 BillWoodruff 235
4 CPallini 195
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 28 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100