Skip to content

Instantly share code, notes, and snippets.

@meleu
Created March 10, 2022 21:44
Show Gist options
  • Save meleu/d99b7e22a5348a928a1d06de67719a7c to your computer and use it in GitHub Desktop.
Save meleu/d99b7e22a5348a928a1d06de67719a7c to your computer and use it in GitHub Desktop.
Fix emojis in filenames in the "Obsidian Flight School"
#!/bin/bash
# emojifix.sh
#############
# Created to fix emojis in filenames in the "Obsidian Flight School"
# https://www.linkingyourthinking.com/obsidian-flight-school
#
# Depends on 'rename' command (sudo apt install rename).
#
# meleu - February/2022
set -eo pipefail
main() {
declare -A arrayEmojiCodes=(
[📚]="ð\302\237\302\223\302\232"
[🗣]="ð\302\237\302\227£"
[𝒇]="ð\302\235\302\222\302\207"
[🥾]="ð\302\237¥¾"
[🎬]="ð\302\237\302\216¬"
[🎛]="ð\302\237\302\216\302\233"
[📑]="ð\302\237\302\223\302\221"
[📖]="ð\302\237\302\223\302\226"
[🔬]="ð\302\237\302\224¬"
[🔥]="ð\302\237\302\224¥"
[🔌]="ð\302\237\302\224\302\214"
[🕹]="ð\302\237\302\225¹"
[🌐]="ð\302\237\302\214\302\220"
[🚢]="ð\302\237\302\232¢"
[🚀]="ð\302\237\302\232\302\200"
)
local emoji
local weirdCode
shopt -s globstar
for emoji in "${!arrayEmojiCodes[@]}"; do
weirdCode="${arrayEmojiCodes[${emoji}]}"
rename -v "s/${weirdCode}/${emoji}/" ./**
done
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment