 Hello and welcome, today we're going to be looking at bulk installing fonts and we're basically going to write a script that we'll download from this website, 1001FreeFonts.com, download a bunch of them, unzip them and install them to your system, all in one script. I'm going to go over the basics, I'm going to start writing like a one-liner, but then I'll show you a script that I've written and go through it in detail so that you can get it and also the script will be available, hopefully if I remember in the links in the description of this video, if not you can always go to my website, type on scripts, click on scripts, notes and then search through there for free fonts and you should be able to find the script. If for some reason I forget to put it in the description of this video, but let's go ahead and have a look at this. So, let's quickly review, if we were to download this I could unzip it, so if I hover over this I can say right click, I can say copy link address, I can say wget, paste in that and then I can say unzip that zip file, you can see we have a ttf file and I should be able to say copy that file to my home directory.localshare fonts and then I should be able to type in cf-cash-f-v and that font will now be, it's updating, it's looking through all the fonts on my system and that font will be now added. Great, let's do that in bulk, so first thing we need to do, as you can see there's multiple pages here and we're going to very basically look through this and I'm just going to say go through the first 100 pages, which is probably more than 100 pages, we can write the script a little more in depth to actually look at what the next page is, I'm not going to do that, I'm just going to start off, I'm going to copy this URL and as you can see we're on page 2 here and of course if I was to say wget, I can put in that URL and if I self-telt dash o dash it's just going to output the HTML to this page, to the screen here, let's go ahead we can make this full screen so we can see things a little bit better, I have the font kind of large so you guys can read a little bit better, which makes things fall into multiple lines but we know that we're looking for the download so actually let's go back to this real quick, we can look through the HTML but real quick what I'm going to do is I'm going to hit either F12 in Chrome or ctrl shift I and I'm going to click this little button and click on this element right here and we can see that you know it says downloads in capital letters which we're kind of new from that button I think we're looking for something unique about these lines and we can search for zip but there's other things that say zip but I think that using downloads would be a good way to go so let's go back here and what I do is I'm going to say now I'm going to pipe the output of that command to grep and I'm going to say look for the word download capitalized and now I get a line of the downloads lines have the word download capitalized and as you can see we can see the href so the the link to the zip file since it's starting with forward slash it's mean it's going to start with that domain so what I could do if I go back to here if I was to go here I can say that so now we know that's the link but starts off with HTTPS www.1001freefonts.com that link now I click that and it's now downloaded that file so now we can put that into a loop so all we have to do is cut but you also notice that each one shows up more than once so let's go ahead go back to our thing here our first little line also gonna say dash Q for quiet we're gonna say download and now put the HTML grab all the lines that say download then I'm gonna say cut dash D backslash single quote also known as a apostrophe and oh field 2 so dash F2 and now we have a list but again we have two of each so I can say sort dash U which will sort them and unique them so now we have this and we have by default the website outputs 10 per page so there you go those are the first 10 from the first page actually second page because we're on page number two what we want to do next is pipe that into well there's different ways we can do this and you in my final script I actually put this through a while loop but we should be able to use set and that might be a little bit better let me get that a try now there's different things you can do here we're gonna be working with the forward slash but instead by default most people use forward slash as their delimiter so if I wanted to replace the forward slash D I would have to do backslash forward slash D and then I would have to put in forward slash I would have to do a whole bunch backslashes but you can really use any character you want as delimiter so I can use the pipe symbol here and that's gonna be easier that way I don't have to backslash stuff out so what I'm gonna do is I'm gonna say take this the forward slash D forward slash and I'm going to replace it with this D forward slash if I get that if I did that yep so that's actually a better option like I said in my final script I was using a while loop I could replace that with this now and it actually saves some processing power but there we have the full URL to each one of those now we can pipe that into a while loop we put it in while or you can actually also dump it into a file and then later on W get can download things from a file list but we're not gonna do that so now I'm gonna pipe that into while and I'm going to say we'll call it while read I'll say Z for zip file do W get dollar sign Z done and what that would do would loop through each one download it but let's say you stop your script and then start it up again you want it to also I think when you get to the first one each page is the same as the last one from the previous page we're gonna do dash C which means if it's already been downloaded it's gonna skip it if it's partially downloaded continue where you left off so now I should be able to run that and it's gonna start downloading each one from that page now if I control C to kill that and I started again you'll notice the first few it said files already downloaded nothing to do and it just skipped over them so there you go we're downloading that so we just downloaded the first 10 from the second page what we can do now and again I'm doing this also one liner I'm gonna go into a script here in a moment that's a little bit cleaner but what we can do is we can say for I in and there's different ways you can do this you can use brace expansions I'm just going to do back ticks and pipe it into while and I'm gonna say I'm sorry not a while we're doing a for loop do and I'm gonna use sequence so seq and again these are back ticks which are next to the one on standard QWERTY keyboard it's not a single quote but I'll just say one through 100 which will download the first hundred pages so for that do this and we're gonna replace this to with dollar sign I and we're gonna add a another done and now that we do this it's going I did something wrong oh I did a pipe and this should be semi-colon there we go so now it's actually starting a page one it's gonna go through the 10 on page one then when it gets to page two it'll skip over the first you will say that already downloads are doing the continue but we're good it's downloading all the zip files for the first hundred pages which would be a thousand fonts right because there's 10 on each page well really you're probably gonna get nine on most pages because like I said I'm pretty sure this website the first one on each page is the same as the last one on the previous page pretty sure and we're gonna get about a thousand fonts going through the first hundred pages there's more than a hundred pages on this website so you can actually probably up that the 200 I don't know how many pages there are we could set our script to look at whatever the next pages but as you can see I can control C to kill this you can see there's a bunch of zip files here and then we can loop through unzip them copy them to our our fonts folder and then update our system so let's have a look at the script that I wrote which kind of puts all this again this is a one liner which is great but kind of hard to read if I go to my temp folder I actually created a folder here and I'm gonna say Vim get fonts we'll go to the top so we've got there shebang line at the top my little GPL notification there with the copyright information for my script here we're saying a variable for our domain set the number of pages so you can set this to wherever you want you can say 100 200 whatever you want then we're doing our for loop like we just did we're gonna use Seq from one to the number of pages that you set there we're doing a loop here again just as we did our one liner looping through all this this is basically our our one liner except for I did a while loop here where I use I use said in there somewhere I can't remember where but this works check out again I'll have a link in the description of this video once it downloads them all once it finishes that that's going to unzip all the zip files so that's just looping through each one and unzipping it because unzip by default you can't just put an asterisk in there so use a while loop there might be a way to do it but we're just gonna use a for loop and then we get here where we move it so it's going to use MK dir to make a directory dash p means if to if fonts doesn't exist create it if local share doesn't create create so it creates any parent directories so if I just said create this directory and dot local or dot local share doesn't exist it would fail but dash p says create all these directories all the way down to that which is first two should exist already because there's other things in those folders for your system once that's created it's now going to look for in the directory you're in all TTF files and OTF it's going to search subdirectories you can't just do copy those because a lot of those zip files have subfolders where the fonts are so it's going to look for these two main formats file types of fonts it's going to loop through them and it's going to move them to that directory up here really I kind of put this in a variable because this is moving it to for the local user as we talked about in the previous video there's a different folder under a usr local share fonts I think or it might just be usr shared fonts check out the previous video for that for a system wide font install but for the local user this is what works and then after they're all unzipped you're going to then run this command to have your system update and look for new fonts but that's it we got you know about 25 30 lines of code to pull down thousands of fonts from that website and install them and again Linux most distributions come with a number of faults there's a lot in the repositories but a lot of those are very basic fonts which is fine if you're doing office stuff but if you want to do stuff more creative you're gonna want fancier fonts I guess you could say and this 1001 fonts is awesome that you can quickly again you can type in something here to see so if I want to films by Chris and see what that looks like I can say update and there you can see what your words look like in those fonts which is pretty cool little film strip almost for films by Chris anyway but again we're both downloading it which means you're not looking at the licenses while you do that the zip files do usually contain the licenses but if you're wearing a script like this you're not using it pretty much every font on this website is free for personal use but some are a lot are only for personal use so if you're gonna use this for commercial use be sure to check out the license so you don't get in trouble so yeah check that out if you're gonna be doing anything beyond just personal use non-commercial use you're good there are a lot that are and I you're probably at the top of the page I bet they have because they have again categories up here top fonts or fonts you would think there would be a way there might be a way on the page somewhere to search for ones with particular licenses of course again I don't know if this violates their terms and agreements by bulk downloading all these it might probably does they also offer up the 10,000 fonts with commercial use for about 20 bucks I've never done that lots of times I just come here and search but sometimes spanned but to go and search for something and when you can just look through the list in your program now remember if you already have a program open GIMP or your office application when you're typing stuff and you want to use a font that you just installed after running this you have to close that program and reopen it in most cases for it's update it's font list also keep in mind I don't know if we make a difference if you installed like 10,000 or 20,000 fonts is that going to affect how that program runs when you're searching through the fonts you know when you have some a writer open and you click on this to search the fonts is it going to affect how quickly you can scroll through the fonts I don't know I have a lot installed right now and it doesn't really affect it and luckily in in Libre writer here it's easy to search if you know the name of your font so like yeah if you know the name of it let's click on this and just start typing do I have any comic or coming soon command so if you know the name of your font some programs make it real easy to search through if you don't know they found if they don't let you search it sometimes it's a little difficult if you're trying to scroll and you have a lot of fun so you may want I don't know all depends on what you want to do now I'm just blabbering thank you for watching again the script is up on a paste bin if you go to paste bin.com forward slash this is the URL here I'll try remember put this in the link in the description of this video if I forget that's it right there or you can always go to filmsbychris.com if you click on software I think I said scripts the other day in the last video software notes will bring you to a page that I have that searches through all my paste bin scripts again I wrote this I didn't write it the best but if you type in fonts it should show up I just wrote this script and open it updates paste bin this list this little search thing updates once a day like at like two in the morning so when you type that you'll probably see this 2018 setup and then you'll see my you'll see this there this script blah blah blah 2018 setup is just a list of applications and setups for when I set up a new system it's things I install in there are some font programs I install there anyway if you want to see some of my after installing a very minimal system some of the things I do this is the stuff I do stuff I install and commands I run to configure my system that's it thank you for watching please visit again filmsbychris.com that's Chris the K there you can search through my videos you can also go to the support section and support me either with PayPal or patreon and remember patreon supporters get early access and downloadable videos I do thank you for watching and as always I hope that you have a great day