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.


Comments

Popular posts from this blog

How to disable USB ports on Mac OS X Mavericks, Yosemite or El Capitan ?