Skip to content

Commit ea4f29b

Browse files
committed
Update ManageGoogleDriveFilesAndFolders.js
Added a function to return an object mapping file names to file IDs for all a user's Google Drive files.
1 parent 0621245 commit ea4f29b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

ManageGoogleDriveFilesAndFolders.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,17 @@ function arrangeDocsToFolders() {
4242
allFiles[i].removeFromFolder(rootFolder);
4343
}
4444
}
45-
}
45+
}
46+
// Loop through all the user's Google Drive files and
47+
// return a JavaScript object literal mapping the file names to
48+
// the file IDs.
49+
function getFileNameIdMap() {
50+
var files = DocsList.getAllFiles(),
51+
fileNameIdMap = {},
52+
i,
53+
fileCount = files.length;
54+
for (i = 0; i< fileCount; i += 1) {
55+
fileNameIdMap[files[i].getName()] = files[i].getId();
56+
}
57+
return fileNameIdMap;
58+
}

0 commit comments

Comments
 (0)