Spaces:
Running
on
Zero
Running
on
Zero
File size: 702 Bytes
a746d34 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
/**
* Creates a folder tree in Google Drive.
*/
function createFolderTree() {
var rootFolder = DriveApp.getRootFolder();
var folderTree = [
{ name: "LineImageGetter", folders: [
{ name: "images" },
{ name: "sequence_diagrams" }
]}
];
createFolders(rootFolder, folderTree);
}
/**
* Recursively creates folders in Google Drive.
* @param {Folder} parentFolder Parent folder.
* @param {Array} folderTree Folder tree structure.
*/
function createFolders(parentFolder, folderTree) {
folderTree.forEach(function(folder) {
var subFolder = parentFolder.createFolder(folder.name);
if (folder.folders) {
createFolders(subFolder, folder.folders);
}
});
} |