A CLI tool to find and remove duplicate files inside a directory.
-
Install as a global .NET tool:
dotnet tool install --global Directory.Deduplicate.Cli
Usage:
dedupe <directory> [options]
Arguments:
<directory> Directory to scan for duplicates
Options:
--sort-by <ModifiedTime|Name> (REQUIRED)
Property to sort by when determining the file copy to keep
--sort-direction <Ascending|Descending> (REQUIRED)
Sort direction when determining the file copy to keep. The first file in the sorted list will be kept
--force
Delete duplicate files. A dry run is performed without this option specified [default: False]
-r, --recursive
Scan sub-directories recursively [default: False]
-v, --verbose
Print file attributes on match [default: False]
--version
Show version information
-?, -h, --help
Show help and usage information
-
Find and delete all duplicates under the
photos
folder and its sub-folders, keeping the oldest file:dedupe photos --recursive --force --sort-by ModifiedTime --sort-direction Ascending