title: Powershell delete files and leave text file
body: <p>I am setting currently writing a script that will delete files over 700 days old. That bit of the script is working fine. I have tested it and it works. I have now been tasked with leaving a text file behind called "name of removed file" with details of how to contact service desk requesting that the file is restored. I have no idea how to go about doing this. So could you please help me?</p>
  
  <p>Here is my deletion script:</p>
  
  <pre><code>foreach ($path in Get-Content "pathList.txt") {
      Write-Host "Trying to delete files older than 700 days, in the folder $path" -ForegroundColor Green
      Get-ChildItem $path -Recurse -Include "*.*" | 
          WHERE {($_.CreationTime -le $(Get-Date).AddDays(-700))} | 
              Remove-Item -Force
  }
  </code></pre>