Created
September 1, 2016 00:25
-
-
Save yoosefi/72f43cff4a645f6eff1bc793350b6a9f to your computer and use it in GitHub Desktop.
Rename a file to its md5 checksum, keeping the extension
This file contains 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 | |
# renames all input files to their md5 checksum, keeping the extension. | |
# this can be used as a nemo script. | |
for each in "$@"; do | |
NAME=$(basename "${each}") | |
EXT="${NAME#*.}" | |
DIR=$(dirname "${each}") | |
MD5=($(md5sum "${each}")) | |
mv "${each}" "${DIR}/${MD5}.${EXT}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment