Using this Batch File
Some time ago a friend of mine gave me a bunch of JPG files, but for some reason she had two copies of every image in the collection. The names of the images had all been randomized, and since there were hundreds of files in the collection it would have taken hours to find and delete the duplicates. With that in mind, I wrote the following batch file that loops through the collection of files and does a binary comparison to find and delete duplicate files.
To use the example code, copy the batch file code from below into Notepad and save it as "_del_dupes.cmd" in the folder where you have duplicate files
Note: As with many utilities that I write - this is a destructive operation, meaning that it will delete files without prompting, so you should always make a backup just in case something goes terribly wrong... ;-]
Batch File Example Code
dir *.jpg /b > _del_dupes.1.txt
for /f "delims=|" %%a in (_del_dupes.1.txt) do (
if exist "%%a" (
dir *.jpg /b > _del_dupes.2.txt
for /f "delims=|" %%b in (_del_dupes.2.txt) do (
if not "%%a"=="%%b" (
echo Comparing "%%a" to "%%b"...
fc /b "%%a" "%%b">NUL
if errorlevel 1 (
) else (