I am looking for a script that, once a new image file(s) is uploaded to my Google Drive (via Google Form image upload, the script will create a folder based off one of these Google Form fields (for example Name), and then move all of the images to that folder.
This is what I've cobbled together so far, but because the folder will be generated based off a field I'm not sure how this would work.
function moveFiles() {
var sourceFolder = DriveApp.getFolderById("Creative Upload (File responses)")
var targetFolder = DriveApp.getFolderById("yyyyyyy") //what should this be?
var files = sourceFolder.getFilesByType(MimeType.JPEG);
while (files.hasNext()) {
var file = files.next();
targetFolder.addFile(file);
file.getParents().next().removeFile(file);
}
}
Any suggestions would be greatly appreciated.