Created
January 29, 2022 16:04
-
-
Save Steffo99/4fecc2aab84132a074bf12dcab59ff16 to your computer and use it in GitHub Desktop.
Reorder and rename fonts in directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/fish | |
for file in * | |
set font_name (fc-query "$file" | egrep 'fullname:' | sed -E 's/fullname: \"(.+)\"\(s\)/\1/g') | |
set file_name (echo "$font_name" | string trim | sed -E 's/[^A-Za-z0-9]/-/g' | string lower) | |
set file_ext (echo (basename "$file" | string split -r -m1 ".")[2] | string lower) | |
set full_name (echo "$file_name.$file_ext") | |
mv $file $full_name | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment