Replace file extensions in Bash

PHOTO EMBED

Sun Mar 28 2021 09:50:19 GMT+0000 (Coordinated Universal Time)

Saved by @FlorianC #bash

#!/bin/bash

for file in *.HTM; do
  name=$(basename "$file" .HTM) # surround the filename with double quotes to account for file names with spaces
  echo mv "$file" "$name.html" # put echo in front when testing to see what the program would do without actually changing anything yet
done
content_copyCOPY

Change file extension from ".HTM" to ".html"