Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $files = Get-ChildItem -Path F:\_Pics_\Cameras\Nikon -filter *-*.NEF -Recurse ; $files -imatch '(DSC_[0-9]{4}-[0-9]{1}).*\.(nef|jpg|NEF|JPG)'
  2. Foreach ($file in $files){
  3.         $dir = $file.Directory
  4.         $newfile = $file.Name -replace "-2",""
  5.         $testfile = "$dir\$newfile"
  6.         if(test-path $testfile){
  7.             if($(Get-item $testfile).Length -eq $file.Length){
  8.                 #-Whatif verwijderen ;)
  9.                 Remove-Item $file.FullName -Whatif
  10.             }
  11.             else {Write-Host $testfile.Length  $($file.fullname).Length}
  12.         }
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement