parent
b5e373375d
commit
cd6d495443
@ -1 +1,2 @@ |
|||||||
myenv |
myenv |
||||||
|
dups.txt |
||||||
|
|||||||
@ -0,0 +1,47 @@ |
|||||||
|
@echo off |
||||||
|
|
||||||
|
:: Activate the virtual environment |
||||||
|
call myenv\Scripts\activate.bat |
||||||
|
|
||||||
|
:: Check if the first argument is a directory |
||||||
|
if not exist "%~1\" ( |
||||||
|
echo Error: '%~1' is not a directory. |
||||||
|
exit /b 1 |
||||||
|
) |
||||||
|
|
||||||
|
:: Get list of images |
||||||
|
setlocal enabledelayedexpansion |
||||||
|
set count=0 |
||||||
|
for %%f in ("%~1\*.jpg" "%~1\*.png") do ( |
||||||
|
set /a count+=1 |
||||||
|
set images[!count!]=%%~nxf |
||||||
|
) |
||||||
|
|
||||||
|
:: Check if we found any images |
||||||
|
if %count% equ 0 ( |
||||||
|
echo No images found. |
||||||
|
exit /b 1 |
||||||
|
) |
||||||
|
|
||||||
|
:: Outer loop |
||||||
|
for /l %%i in (1,1,%count%) do ( |
||||||
|
set outer_image=!images[%%i]! |
||||||
|
|
||||||
|
:: Inner loop (only later images to avoid double-checks) |
||||||
|
set /a j=%%i+1 |
||||||
|
for /l %%j in (!j!,1,%count%) do ( |
||||||
|
set inner_image=!images[%%j]! |
||||||
|
|
||||||
|
echo Compairing files: !outer_image! TO !inner_image! |
||||||
|
echo. |
||||||
|
python dedup.py "%~1\!outer_image!" "%~1\!inner_image!" |
||||||
|
set exit_code=!errorlevel! |
||||||
|
if !exit_code! gtr 0 if !exit_code! leq 2 ( |
||||||
|
echo %~1\!outer_image!>> dups.txt |
||||||
|
goto :break_inner |
||||||
|
) |
||||||
|
) |
||||||
|
:break_inner |
||||||
|
) |
||||||
|
|
||||||
|
endlocal |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
source myenv/bin/activate |
||||||
|
|
||||||
|
# Check if the first argument is a directory |
||||||
|
if [ ! -d "$1" ]; then |
||||||
|
echo "Error: '$1' is not a directory." |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
# Get list of images |
||||||
|
shopt -s nullglob |
||||||
|
pushd "$1" || exit 1 |
||||||
|
images=(*.jpg *.png) |
||||||
|
popd || exit 1 |
||||||
|
|
||||||
|
# Check if we found any images |
||||||
|
if [ ${#images[@]} -eq 0 ]; then |
||||||
|
echo "No images found." |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
# Outer loop |
||||||
|
for ((i = 0; i < ${#images[@]}; i++)); do |
||||||
|
outer_image="${images[$i]}" |
||||||
|
|
||||||
|
# Inner loop (only later images to avoid double-checks) |
||||||
|
for ((j = i + 1; j < ${#images[@]}; j++)); do |
||||||
|
inner_image="${images[$j]}" |
||||||
|
|
||||||
|
echo -e "Compairing files: $outer_image TO $inner_image \n" |
||||||
|
python3 dedup.py "$1/$outer_image" "$1/$inner_image" |
||||||
|
exit_code=$? |
||||||
|
if [ $exit_code -gt 0 ] && [ "$exit_code" -le 2 ]; then |
||||||
|
echo "$1/$outer_image" >> dups.txt |
||||||
|
break # No need to check more once found duplicate |
||||||
|
fi |
||||||
|
done |
||||||
|
done |
||||||
Loading…
Reference in new issue