0

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?

Wekend
  • 1
  • 1
  • Welcome to [so]. What is is ZipFolder? Please add a [mcve] – Rubén Sep 15 '22 at 23:42
  • Does this answer your question? [Creating a zip file inside Google Drive with Apps Script](https://stackoverflow.com/questions/13259041/creating-a-zip-file-inside-google-drive-with-apps-script) – Martin Zeitler Sep 16 '22 at 00:26
  • Oops. I posted the wrong code on accident. I've updated it now. – Wekend Sep 17 '22 at 00:05

0 Answers0