homebrew-fonts/prep 1 font.sh
2024-09-27 10:13:06 -05:00

32 lines
No EOL
1.3 KiB
Bash
Executable file

#! /bin/zsh
#if current working directory is named font_files or custom_fonts, exit
if [[ $PWD == *"font_files" ]] || [[ $PWD == *"custom_fonts" ]]; then
echo "You are in the wrong directory. Please move to the individual font folder."
exit
fi
#recursively find all .zip files and unzip them
find . -name '*.zip' -exec unzip {} \;
# Make OTF and TTF folders if they don't exist
mkdir -p OTF TTF "other files"
# Recurse through all folders and subfolders and move files that are not .ttf or .otf into the "other files" folder
find . -type f -exec mv {} "other files" \;
# Recurse through all folders and subfolders and delete all .DS_Store files
find . -name '.DS_Store' -type f -delete
# Recurse through all folders and subfolders and delete all .g2n files
find . -name '*.g2n' -type f -delete
find . -name '*.ofm' -type f -delete
find . -name '*.cfg' -type f -delete
find . -name '*.zip' -type f -delete
# Recurse through all folders and subfolders and move all .ttf files into the TTF folder
find . -name '*.ttf' -type f -exec mv {} TTF \;
# Recurse through all folders and subfolders and move all .otf files into the OTF folder
find . -name '*.otf' -type f -exec mv {} OTF \;
# Recurse through all folders and subfolders and delete all empty folders
find . -type d -empty -delete