Zip large files in Google Apps Script

Viewed 56

I'm trying to create an archive system built into Google Apps Script. I want to be able to zip a large folder that is already in Google Drive without having to download anything.

I've tried the following code:

var folder = DriveApp.getFolderById(<FOLDER_ID>);
folder.createFile(Utilities.zip(folder.getFiles(), 'newFiles.zip'));

This correctly zips folders, but when I try to run it on larger folders, it throws this error after running for a while:

Exception: Unexpected error while getting the method or property zip on object Utilities.
at zipping(Code:172:24)
at ZipFolder.zip(Code:30:22)
at zip(Code:9:66)

Anyone know what's going on?

0 Answers
Related