PowerShell script to delete files from list and output list of deleted file PowerShell script to delete files from list and output list of deleted file powershell powershell

PowerShell script to delete files from list and output list of deleted file


I think this should help.

Script:

$TargetFolder = “Pathofyourfolder”$Files = Get-ChildItem $TargetFolder -Exclude (gc List.txt)  -Recurseforeach ($File in $Files)    { write-host “Deleting File $File” -foregroundcolor “Red”; Remove-Item $File | out-null }