#!/bin/bash # Copyright (c) 2025 by Robert Strutts # License: MIT source myenv/bin/activate # 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 if [ "$2" = "forreal" ]; 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 [ "$2" != "forreal" ] && [ -f "dups.txt" ]; then echo "Here are your duplicate files:" more dups.txt else echo "No Dups found" fi