title: Powershell, Mass moving files of a certain type
body: <p>I want to make a script which will take a parent directory which has a number of child directories which have files in them. Using a listing I wish to move all of the files in the child directories in to the parent directory. </p>
  
  <p>I have created the following code so far which gives a listing of all the files of the specified type in the child directories but I am unsure how to a mass move of all the child files. </p>
  
  <pre><code>    Write-host "Please enter source Dir:"
  $sourceDir = read-host
  
  Write-Host "Format to look for with .  :"
  $format = read-host
  
  #Write-host "Please enter output Dir:"
  #$outDir = read-host
  
  $Dir = get-childitem -Path $sourceDir -Filter $format -recurse | format-table name
  
  $files = $Dir | where {$_.extension -eq "$format"} 
  $files #| format-table name
  </code></pre>