title: Powershell - find,copy,list out missing files
body: <p>I'm using PowerShell to help me find a list of files from a list created in CVS. I need it to search through a folder and its sub-folder. copy the files listed in the CVS and output the files that are not founded in the folder to a log.txt file. </p>
  
  <p>I found this script listed below but I don't know how to get it to output a list of missing files into a log.txt. </p>
  
  <pre><code>$source      = "C:\Folder-A"
  $destination = "C:\Folder-B"
  
  $file_list = Get-Content "C:\Book1.csv" 
  
  foreach ($file in $file_list){
      foreach($dir in (Get-ChildItem $source -Recurse)){
          if($file -eq $dir.name){
              if(-not(test-path "$destination\$file")){
                  Copy-Item $dir.fullname -Destination $destination
              }
          }
      }
  }
  </code></pre>