diff --git a/hashify-filename/README.md b/hashify-filename/README.md index a512e85..e040e89 100644 --- a/hashify-filename/README.md +++ b/hashify-filename/README.md @@ -1,6 +1,7 @@ ## Hashify Filename -With this little script you can rename given files to its [MD5](https://en.wikipedia.org/wiki/MD5) hashsum. File extension won't be changed. +This little script renames given files to its [MD5](https://en.wikipedia.org/wiki/MD5) hashsum. File extension won't be changed. +This allows duplicate files in the same directory to be easily detected and merged / overwritten. This script is just a fork of [randomize-filename](../randomize-filename). diff --git a/hashify-filename/hashify-filename.sh b/hashify-filename/hashify-filename.sh index 054e71b..3e9f8a2 100755 --- a/hashify-filename/hashify-filename.sh +++ b/hashify-filename/hashify-filename.sh @@ -38,7 +38,9 @@ function rename() { continue fi filename="$(md5sum $filepath | awk '{print $1}')$ext" - mv "$filepath" "$base/$filename" + if [ $file != $filename ]; then + mv -f "$filepath" "$base/$filename" + fi done }