Created
April 11, 2015 22:10
-
-
Save sashka/661d2bcedb644ff6af60 to your computer and use it in GitHub Desktop.
Rename file with the SHA1 of its content.
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 | |
find . -type f -name '*.m[p4][a3]' -exec bash -c 'fn=$(basename "$0"); ext=$(echo "${fn##*.}" | tr '[A-Z]' '[a-z]'); mv "$0" "$(sha1sum "$0" | cut -d" " -f1).$ext"' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the description is misleading. This script renames all the *.mp3, *.mpa & *.mp4 files in current directory with sha1sum of their contents.