FolderIterator

An object that allows scripts to iterate over a potentially large collection of folders. Folder
iterators can be accessed from `https://developers.google.com/apps-script/reference/drive/drive-app`, a `https://developers.google.com/apps-script/reference/drive/file`, or a `https://developers.google.com/apps-script/reference/drive/folder`.

```javascript
// Log the name of every folder in the user's Drive.
const folders = DriveApp.getFolders();
while (folders.hasNext()) {
  const folder = folders.next();
  Logger.log(folder.getName());
}
```

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/drive/folder-iterator#getContinuationToken()` | `String` | Gets a token that can be used to resume this iteration at a later time. |
| `https://developers.google.com/apps-script/reference/drive/folder-iterator#hasNext()` | `Boolean` | Determines whether calling `https://developers.google.com/apps-script/reference/drive/folder-iterator#next()` returns an item. |
| `https://developers.google.com/apps-script/reference/drive/folder-iterator#next()` | `https://developers.google.com/apps-script/reference/drive/folder` | Gets the next item in the collection of files or folders. |

## Detailed documentation

### `getContinuationToken()`

Gets a token that can be used to resume this iteration at a later time. This method is useful
if processing an iterator in one execution exceeds the maximum execution time. Continuation
tokens are generally valid for one week.

#### Return


`String` --- A continuation token that can be used to resume this iteration with the items that
remained in the iterator when the token was generated.

*** ** * ** ***

### `hasNext()`

Determines whether calling `https://developers.google.com/apps-script/reference/drive/folder-iterator#next()` returns an item.

#### Return


`Boolean` --- `true` if `https://developers.google.com/apps-script/reference/drive/folder-iterator#next()` returns an item; `false` if not.

*** ** * ** ***

### `next()`

Gets the next item in the collection of files or folders. Throws an exception if no items
remain.

#### Return


`https://developers.google.com/apps-script/reference/drive/folder` --- The next item in the collection.