Delete duplicate files Based On File Size With WIndows Batch

This should do the job:

@ECHO OFF
SETLOCAL EnableDelayedExpansion



REM **************************************************

REM Source directory
SET source=C:\adjust\path\to\folder

REM Set folder name
SET folder_name=folder

REM **************************************************



REM Creating a new directory to sort out files
IF NOT EXIST "%source% TEMP" MD "%source% TEMP"

REM Sorting out files without duplicates
FOR /F "tokens=1,* delims=~" %%A IN ('DIR /S/B/A-D "%source%"') DO (
    IF NOT EXIST "%%~fA~2%%~xB" COPY "%%~fA~1%%~xB" "%source% TEMP\%%~nxA~1%%~xB" >nul 2>&1
)

REM Sorting out files with biggest size
FOR /F "tokens=1,* delims=~" %%F IN ('DIR /S/B/A-D "%source%"') DO (
    SET path=%%~dpF
    SET name_1=%%~nF~
    FOR /F "delims=" %%A IN ('DIR "%%~fF*" /S/B/O:-S') DO (SET biggest=%%A && CALL :copy)
)

REM Deleting all duplicates
RD /S /Q "%source%"

REM Renaming TEMP to source
REN "%source% TEMP" "%folder_name%"
CLS
ECHO.
ECHO  Done^^!
ECHO.
PAUSE



:copy
SET name_2=%biggest:*~=%
COPY "%biggest%" "%source% TEMP\%name_1%%name_2%" >nul 2>&1 && DEL "%path%%name_1%*" >nul 2>&1
EXIT /B

Bare in mind: this will delete the entire folder and then rename the temporary folder accordingly. If you have any files which do not have a ~ in their name then those files are going to be deleted!!!