Implementing Multi-threading/Parallel processing in script

Cryso Agori

V.I.P. Member
I have this simple script that allows me to copy and paste items in a different folder while also changing their name in windows Powershell.

Code:
$destfolder = '.\destfolder\'
get-childitem -Recurse -File .\srcfolder\ | Foreach-Object {
    $newname = $_.name
$newname = $_.directory.parent.name + '-' + $_.directory.name + '-' + $_.name
Copy-Item -Path $_.FullName -Destination (Join-Path $destfolder $newname) -Verbose
}

I'm wondering how to add multi-threading/parallel processing and maybe robocopy if possible to make it go faster.
 
  • Like
Reactions: Ral

Ral

[SUBTRACTED]
Administrator
Pronouns
He/Him
It's ok, Stackoverflow and reddit got me what I needed. your fine.:yousmart
the_key_angle-1536x1152.jpeg
 
Back
Top