Posted on 06-18-2018 06:50 AM
I've been trying to figure this out but I am no scripting guru so I'll just explain the goal and hope someone knows alot more than me!
We've gotten a request to remove literally 200+ fonts from every system in 3 different labs. I am trying to write a script to do this but am running into alot of roadblocks.
First I am writing this in Apple Script editor...using the following commands for each font:
do shell script "rm /library/fonts/fontname*"
This runs into an error if that font doesn't exist and the script stops there, i've tried to add 2> /dev/null to the end of that line but then it says there's an unexpected end of line but found number.. Any help is appreciated, thanks!
Posted on 06-18-2018 07:03 AM
One way you could do this easier in my opinion is to set up a perfect machine how you want it and capture the various font folders from it and package them up. After they have been packaged up, go to the machine in question and blow away the contents of ALL fonts from those fonts folders and replace with your new package.
Not the best method, but much easier to script and you will literally have blessed everything that goes into it. When doing this, leave everything in /System/Library/Fonts alone of course, but you should be able to empty the contents of the /Users/<username>/Library/Fonts and /Library/Fonts and build it with known good copies of the fonts you wish to make available to your users.