Skip to content

Instantly share code, notes, and snippets.

@sebastiandg7
Created August 30, 2018 17:46
Show Gist options
  • Save sebastiandg7/e3e19d0827608bc393ea53a89e1e586b to your computer and use it in GitHub Desktop.
Save sebastiandg7/e3e19d0827608bc393ea53a89e1e586b to your computer and use it in GitHub Desktop.
Delete duplicated files in linux
#!/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