fix formatting and messaging

This commit is contained in:
rlogwood
2024-06-07 17:42:40 -04:00
parent 2e093f6856
commit b67f1c8c9a

View File

@ -189,7 +189,6 @@ function Get-Duplicates {
if ($dup_files.Count -gt 1) {
$dups_hash[$entry.key] = $dup_files | Sort-Object -Property Creation -Descending
#$dup_files = $dups_hash[$entry.key]
}
}
$dups_hash
@ -214,14 +213,18 @@ function Show-Duplicates {
}
Write-Output ""
Write-Output "Found duplicate $($num_dups): $($entry.Key)"
Write-Output "Found duplicate $(Format-NumberWithCommas $num_dups): $($entry.Key)"
for ($i = 0; $i -lt $dup_files.Count; $i++) {
# only count disk space of removals
if ($i -gt 0) {
$total_dup_size += $dup_files[$i].Size
}
Write-Output "$($hash_num): $($dup_files[$i].ToString())"
}
}
Write-Output ""
Write-Output "Found $num_dups duplicate file hashes."
Write-Output "Found $(Format-NumberWithCommas $num_dups) duplicate file hashes."
ShowSizes "Duplicate Files Size" $total_dup_size
}
@ -282,7 +285,7 @@ function DeleteDuplicateFile {
Write-Output "Deleting File: $($File.Name) $(Format-NumberWithCommas $File.fileSizeInKB) KB"
BackupDuplicateFile -file $File -backupDirectory $backup_dir
# Force delete a read-only or protected file
Write-Output " ... would deleting: $($File.FullName)"
Write-Output " ... deleting: $($File.FullName)"
Remove-Item -Path $File.FullName -Force
Write-Output " - removed from: $($File.Directory)"
}