Delete duplicate files safely

$directory="/Volumes/photography/DataSpace-Photography/FUTU/Imported/";

$files=Composition[
FileNames["*.dng"|"*.DNG",{$directory},Infinity]&
][$directory];

data[1]=Composition[
GatherBy[#,ByteCount/.FileInformation[#]&]&/@#&,
(*Length,*)
Cases[#,{_,__}]&,
GatherBy[#,{StringReplace[FileBaseName[#],RegularExpression["-[0-9]"]-> ""]}&]&
][$files]

data[1]//Length

Delete files safe to delete:

data[2]=Composition[
((Print[#];DeleteFile[#])&/@#[[2;;]])&/@#&,
(Print[#];#)&,
RandomSample[#,2]&,
SortBy[#,{StringLength[FileBaseName[#]],FileBaseName[#]}&]&/@#&,
Cases[#,{_,__}]&,
Join@@#&
][data[1]]

Move files unsafe to delete to a backup directory:

data[3]=Composition[
(
(
Print[#];
CopyFile[#,FileNameJoin[{$mengTemporaryDirectory,FileNameTake[#,-1]}]];
DeleteFile[#]
)&/@#[[2;;]]
)&/@#&,
(*(Print[#];#)&,*)
(*RandomSample[#,2]&,*)
SortBy[#,{StringLength[FileBaseName[#]],FileBaseName[#]}&]&/@#&,
Join@@#&/@#&
][data[1]]