Click here to Skip to main content
13,048,805 members (71,134 online)
Rate this:
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:


and copy the contents to


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!!!!

Posted 27-Mar-12 11:07am
Rate this: bad
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
Rate this: bad
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.


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 28 Mar 2012
Copyright © CodeProject, 1999-2017
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