Skip to content

Instantly share code, notes, and snippets.

@singularitti
Created August 21, 2025 09:23
Show Gist options
  • Save singularitti/6a8e15b2b0967f93b9f23b927a98a0d8 to your computer and use it in GitHub Desktop.
Save singularitti/6a8e15b2b0967f93b9f23b927a98a0d8 to your computer and use it in GitHub Desktop.
Generate sorted font list with quotes #OS #file #font #Shell
# This command finds all `.otf` font files in the current directory and subdirectories,
# sorts them alphabetically by path, and outputs each as: `font "Folder/File.otf"`
#
# Step by step:
# 1. `find . -type f -name "*.otf"` → locate all `.otf` files
# 2. `sort` → order results alphabetically
# 3. `sed 's|^\./|font "|; s|$|"|'` → remove leading "./", add 'font "' prefix, and closing '"'
find . -type f -name "*.otf" \
| sort \
| sed 's|^\./|font "|; s|$|"|'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment