Created
April 15, 2021 12:20
-
-
Save chasemc/304eee5b9dd17bf3b4a80ae94bc0d06e to your computer and use it in GitHub Desktop.
Rename files by md5 and chosen extension
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/bash | |
# $1 is the file(s') name to find and hash | |
# $2 is the extension to be given to each renamed file | |
find $1 -print0 | xargs -0 md5sum | | |
while read -r newname oldname; do | |
mv -v "$oldname" "$newname".$2 | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In a directory containing "some_data.tsv":
bash ./md5_as_filename.sh "some_data.tsv" "descriptiveextension"