title: Moving files with the same name to matching named folders
body: <p>Beginner and I'm stuck.</p>
  
  <pre><code>$filter= "Alive"
  $source="D:\Users\Heather's\VendorScans\*"
  
  Get-ChildItem -recurse | ?{ $_.PSIsContainer } |Select-Object fullname | Where-Object {$_.fullname -match $filter} 
  $destination= (Where-Object {$_.fullname -match $filter})
  
  Copy-Item $source -destination $destination -recurse
  </code></pre>
  
  <p>Initial problem is moving files that are named for example "Alive" to a folder called "Alive".
  So I'm trying to copy files from a Subfolder within a directory folder and I'm moving it to a double nested subfolder on the same drive. So <code>D:\Users\Heather's\VendorScans\*</code> to <code>D:\Users\Heather's\Vendors\AliveHospice</code>. Etc. The destination will change depending on if it matches the file name. The only problem is when I run this, it drops the files in the main directory so <code>D:\Users\Heather's</code> instead of going to the fullname path. If anyone could link me to some helpful resources or nudge me in the right direction I'd be grateful. Still not sure how to access subfolders or create unique destinations. Do I need a loop?</p>