Click here to Skip to main content
15,939,960 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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!!!!


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.

Share this answer
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
Share this answer

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900