Hi everyone, I’m an absolute beginner in programming and I need some guiding. This is what I want to do: Copy a particular file located in a subfolder in Drive and paste it into multiple subfolders using Google Script. This is what I’ve done so far: function copyFilesintoMultipleFolders() { var srcFolder = DriveApp.getFolderById("XXXXXXXXXXXXXXXXXXXXXXXX") var dstFolder = DriveApp.getFolderById("YYYYYYYYYYYYYYYYYYYYYYYY") var file = DriveApp.getFileById("ZZZZZZZZZZZZZZZZZZZZZZZZ") while (dstFolder.hasNext()){ var f = file.makeCopy(dstFolder) if (file.getMimeType() == MimeType.GOOGLE_APPS_SCRIPT){ Drive.Files.update({"parents": [{"id": dstFolder}]}, f.getId()); } } } But I got stuck at the while loop because I get this error: “TypeError: Cannot find function hasNext”. What did I do …

Member Avatar
Member Avatar
+0 forum 1

The End.