Here is a script that remove all files in Folder1 if this file exists in Folder2.
So, it does something like: Folder1 - Folder2
in other words, it removes duplicate files.
This script test only the filename: remove the file in Folder1 if the same filename is present in Folder2.
I would to improve it, adding a size file test. remove the file only filesize of both files are the same.
Do you have an idea ?
My line ECHO %%~zf cannot display the file size !!!
Code: Select all
FOR /F "Delims=" %%f in ('DIR /b /on "%Fold2%\*.*"') DO (
IF EXIST "%Fold1%\%%f" DEL /F /Q "%Fold1%\%%f"
REM ECHO %%~nf --- %%~zf
Put the script next Folder1 and Folder2.