From the course: Google Apps Script for JavaScript Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Listing folder names

Listing folder names - Google Docs Tutorial

From the course: Google Apps Script for JavaScript Developers

Start my 1-month free trial

Listing folder names

- [Instructor] Now as you can imagine, while we continue to keep testing out our script, more and more output folders are going to be generated inside of our MarkdownGen folder. And eventually, this folder is going to get messy as well. The first step into creating a more organized system is for us to be able to tell the names of the folders inside of a particular folder. Our goal is to limit the folder count to only having a certain amount of generated folders at any given time inside of the MarkdownGen folder. Let's go over to our script project and in our utilities, we're going to create a new method. Let's go ahead and scroll down to the end of our script. We'll add some spaces so we can add a new function and we're going to call this function getFolderNames and we're going to supply a root folder where we should search for the names of the folders inside of it. Now just like we did before, we're going to need to get a reference to a folder iterator so let's create a new variable…

Contents