Asked by:
Copy-Item using Windows PowerShell Multithreading?

General discussion
-
Hello all,
I need to figure out a way to copy a number of 300 files to the same directory destination on a remote computer in parallel.
Until now, I am doing this with copy-item file*.
But, I'd like to use a parallel method so that I can copy many files to a remote server at once, to lower the total copy time.
What is the best way to do this?
Any help very much appreciated.- Changed type tionescu Wednesday, September 5, 2018 10:09 AM daia
Wednesday, September 5, 2018 8:26 AM
All replies
-
Use RoboCopy. It has an option to set the number of threads as high as you like.
\_(ツ)_/
Wednesday, September 5, 2018 8:42 AM -
Hi jrv,
Wrong. Does the repocopy work for remote computer destination? Seems not.
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy
I found something in Powershell but I am still waiting for more answers.
Wednesday, September 5, 2018 9:19 AM -
It absolutely does. It copies just like Copy-Item bu with multi-threading.
Search harder for more information.
In PowerShell you can use a workflow but it will never be as fast as RoboCopy.
\_(ツ)_/
Wednesday, September 5, 2018 9:22 AM -
Can you provide an example? After all this post is for the solution.Wednesday, September 5, 2018 9:32 AM
-
This forum is to answer questions about scripting. It is not a free script writing forum and it is not a free consulting forum.
Please read the documentation for RoboCopy and search for numerous blog articles on how to use this utility.
RoboCopy is not a script it is a system utility. It is part of the base OS and not part of PowerShell.
Here are more than 100 examples and articles HERE
\_(ツ)_/
- Edited by jrv Wednesday, September 5, 2018 9:39 AM
Wednesday, September 5, 2018 9:39 AM -
Please carefully review the following links to set your expectation for posting in technical forums.
This Forum is for Scripting Questions Rather than script requests
- Script Gallery.
- Script Center
- Script requests
- Posting guidelines
- Handy tips for posting to this forum
- How to ask questions in a technical forum
- Rubber duck problem solving
- How to write a bad forum post
- Help Vampires: A Spotter's Guide
- This forum is for scripting questions rather than script requests
\_(ツ)_/
Wednesday, September 5, 2018 9:40 AM -
Hellooooo
Are you trying to force me into this robocopy or what?
I am more interested in something like foreach - parallel ($f in $files) { Copy-Item $f X:\ }
I dont even know your name. Please let other people to answer.
Wednesday, September 5, 2018 9:51 AM -
help about_workflow
We will not write a solution for you.
\_(ツ)_/
Wednesday, September 5, 2018 10:00 AM -
You / one or more are annoying little devil, aint you?Wednesday, September 5, 2018 10:10 AM
-
I try do my best to answer in the most helpful way.
Learning technology can be very frustrating. Take some time to get the basics.
\_(ツ)_/
Wednesday, September 5, 2018 4:55 PM