Removes duplicate files.
Removes duplicate files.
This project is deprecated.
It is simpler to use Get-DuplicateItem
to get duplicates, and remove them by Remove-Item
.
Install-Module Remove-DuplicateItem -Repository PSGallery -Scope CurrentUser -Verbose
# List
Remove-Duplicates -Path D:/foo -Scope 'withinFolder'
# Delete
Remove-Duplicates -Path D:/foo -Scope 'withinFolder' -Mode 1
Q: What is a duplicate file?
A: Has separate file[s] with:
Q: What is the original file?
A: An original file is a duplicate file but with the shortest name among all duplicates found. For instance:
Within-folder: C:\folder_with_duplicates\file.txt
and C:\folder_with_duplicates\file_with_longer_name.txt
are marked as duplicates. The former file.txt
has a shorter name than the others file_with_longer_name.txt
. Hence, file.txt
is chosen to be the original file.
Across-folder: C:\folder1\file.txt
and C:\folder2\file_with_longer_name.txt
are marked as duplicates. The former file.txt
has a shorter name than the others file_with_longer_name.txt
. Hence, file.txt
is chosen to be the original file.
Q: Help! I am getting an error 'File C:\Users\User\Remove-Duplicates\Remove-Duplicates.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.'
Set-ExecutionPolicy Unrestricted -Force
and press ENTER. Try running the script again. You can easily restore the security setting back by using Set-ExecutionPolicy Undefined -Force
Most people create duplicate files within a specific folder either accidentally, or forgetfully, or obliviously