Created
September 14, 2015 17:17
-
-
Save Jan-Zeiseweis/dd9fd9fe5716d73e9b95 to your computer and use it in GitHub Desktop.
Unzip all zip files in a directory and remove unzipped file if a file with the same md5checksum already unzipped
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 | |
for zip_file in *.zip; do | |
unzip -q $zip_file && rm $zip_file | |
file=${zip_file%.zip} | |
read cksm _ < <(md5sum "$file") | |
if ((arr[$cksm]++)); then | |
echo "rm $file" | |
rm $file | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment