Last active
November 7, 2018 11:19
-
-
Save skkut/65584b13e92adf9ae522a04f7fd13e5b to your computer and use it in GitHub Desktop.
Powershell script to compare 2 folders and delete common files in target folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$compareFolder = 'C:\sample_compare_folder' | |
$targetFolder = 'C:\sample_target_folder' | |
$compareFiles = Get-ChildItem -Path $compareFolder -File | |
$targetFiles = Get-ChildItem -Path $targetFolder -File | |
$targetFiles | Where-Object {$compareFiles.BaseName -contains $_.BaseName} | Remove-Item -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment