Created
August 30, 2018 17:46
-
-
Save sebastiandg7/e3e19d0827608bc393ea53a89e1e586b to your computer and use it in GitHub Desktop.
Delete duplicated files in linux
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
#!/bin/bash | |
declare -A arr | |
shopt -s globstar | |
for file in **; do | |
[[ -f "$file" ]] || continue | |
read cksm _ < <(md5sum "$file") | |
if ((arr[$cksm]++)); then | |
echo "rm $file" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment