Posts

Showing posts from May, 2017

How to rename filenames to their corresponding md5 hash on mac ?

The following command in terminal app renames the files located in directory to their corresponding md5 hash on macOS. 
Steps:
1. Open Terminal.app and go to the directory containing files. 2. Run following command in terminal to rename files by MD5 on macOS.

macOS-system$ for F in *.*; do mv $F "$(md5 "$F" | cut -d' ' -f4).${F##*.}"; done
The above shell command renames all files in the current directory to their md5.