Created
September 27, 2015 05:15
-
-
Save yrgoldteeth/07e4418482086adad970 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Check for duplicate files using an associative array indexed with the SHA sum of the files | |
| unset flist; declare -A flist; | |
| while read -r sum fname; do | |
| if [[ ${flist[$sum]} ]]; then | |
| printf 'rm -- "%s" # Same as >%s<\n' "$fname" "${flist[$sum]}" | |
| else | |
| flist[$sum]="$fname" | |
| fi | |
| done < <(find . -type f -exec sha256sum {} +) >rmdups |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment