title: Powershell search subfolders for specific folder and copy
body: <p>I'm trying to write a powershell scripts to search a folder and its subfolders for a specific folder from a csv file and then copy that folder elsewhere.</p>
  
  <pre><code>[CmdletBinding()]
  Param(
      [Parameter(Mandatory=$True,Position=1)]
      [string]$filePath,
      [Parameter(Mandatory=$True,Position=2)]
      [string]$InstanceName
  )
  
  Import-CSV -Delim ',' -Path $filePath  | ForEach-Object {
      Get-ChildItem -Path D:\Folder\$InstanceName -Directory -Recurse
      Copy-Item $_.FOLDERNAME d:\CopyFolder\$InstanceName -recurse
  }
  </code></pre>
  
  <p>That seems to run forever and obviously errors a lot because the files aren't there when it tries to copy. Is there a way to just use Copy-Item if I don't know the specific path? OR some other alternative way to go about this?</p>