-
-
Save mbutler/aabcdeb576d84ebf00aed931d56e70fe to your computer and use it in GitHub Desktop.
google script to list all subfolder content of a particular folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function listFolders(folder) { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
sheet.appendRow(["Name", "Folder", "Date", "Size", "URL", "Download", "Description", "Type"]); | |
var folder = DriveApp.getFolderById("0BxGcFSIReuGfOTJ0dTloY2xWS0E"); | |
var subfolders = folder.getFolders(); | |
while (subfolders.hasNext()) { | |
//Logger.log(folder); | |
var name = subfolders.next(); | |
while (subfolders.hasNext()) { | |
//Logger.log(folder); | |
var name = subfolders.next(); | |
var files = name.getFiles(); | |
var cnt = 0; | |
var file; | |
while (files.hasNext()) { | |
var file = files.next(); | |
cnt++; | |
Logger.log(file); | |
Logger.log(cnt); | |
data = [ | |
file.getName(), | |
name, //folder name | |
file.getDateCreated(), | |
file.getSize(), | |
file.getUrl(), | |
"https://docs.google.com/uc?export=download&confirm=no_antivirus&id=" + file.getId(), | |
file.getDescription(), | |
file.getMimeType(), | |
]; | |
sheet.appendRow(data); | |
}; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment