#!/bin/bash # Copyright (c) 2025 by Robert Strutts # License: MIT if [ -d myenv ]; then source myenv/bin/activate fi if [ -d .venv ]; then source .venv/bin/activate fi # Remove trailing slash path="${1%/}" start_time=$(date +%s) # Check if the first argument is a directory if [ ! -d "$path" ]; then echo "Error: '$path' is not a directory." exit 1 fi do_for_real=false for arg in "$@"; do if [ "$arg" == "-forreal" ]; then echo "Found -forreal flag" do_for_real=true break fi done if [ $do_for_real = true ]; then mkdir -p "$path/dups" fi # Get list of images for only png shopt -s nullglob pushd "$path" || exit 1 images=(*.png) popd || exit 1 source do_dups.inc # Get list of images for only jpg pushd "$path" || exit 1 images=(*.jpg) popd || exit 1 source do_dups.inc end_time=$(date +%s) elapsed=$((end_time - start_time)) # Convert to hours, minutes, seconds hours=$((elapsed / 3600)) minutes=$(( (elapsed % 3600) / 60 )) seconds=$((elapsed % 60)) printf "Total time to dedup everything: %02d:%02d:%02d\n" $hours $minutes $seconds if [ $do_for_real = true ] && [ -f "dups.txt" ]; then echo "Here are your duplicate files:" more dups.txt else echo "No Dups found" fi