MutatedBass,

Here’s a script from GPT4:


<span style="color:#323232;">#!/bin/bash
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Create a temporary file for storing file checksums
</span><span style="color:#323232;">tempfile=$(mktemp)
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Generate MD5 checksums for all files in the current directory and its sub-directories
</span><span style="color:#323232;">find . -type f -exec md5sum '{}' ; | sort > $tempfile
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Detect and delete duplicates
</span><span style="color:#323232;">awk 'BEGIN {
</span><span style="color:#323232;">    lasthash = "";
</span><span style="color:#323232;">    lastfile = "";
</span><span style="color:#323232;">}
</span><span style="color:#323232;">{
</span><span style="color:#323232;">    if ($1 == lasthash) {
</span><span style="color:#323232;">        print "Deleting duplicate file: " $2;
</span><span style="color:#323232;">        system("rm -f ""$2""");
</span><span style="color:#323232;">    } else {
</span><span style="color:#323232;">        lasthash = $1;
</span><span style="color:#323232;">        lastfile = $2;
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">}' $tempfile
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Clean up
</span><span style="color:#323232;">rm -f $tempfile
</span>

This script can be run with Termux from the root of your internal storage. Usually /sdcard or /storage/emulated/0. Do not confuse this with running from root if you are rooted.

Before using a script that interacts with your files you should backup anything that is important just in case.

Furthermore, if you comment out:


<span style="color:#323232;">system("rm -f ""$2""");
</span>

By adding a # in front of it like this:


<span style="color:#323232;"># system("rm -f ""$2""");
</span>

You can run the script and see what files the script would delete without actually deleting them. I would recommend doing this as I have not tested this script.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • Ask_kbincafe
  • oklahoma
  • feritale
  • SuperSentai
  • KamenRider
  • All magazines