Using google appscript we can zip a google drive folder. But one problem
arises. In google drive you can keep repeating named (same named) files
in single folder. But zip file can't do it. So gives a fatal error
without even giving a hint. By using this code you can get rid of
repeated files and zip folder.
function zipfolder(e) {
var foldername = e.parameter.emailAddressbx;
try{
var folder = DocsList.getFolder("CV/"+foldername);
}
catch (e) {
Browser.msgBox(e);
Browser.msgBox("Given folder doesn't exist!");
}
var cvlist=[];
var j=0;
var found = false;
for(i=0;i for(k=0;k if(folder.getFiles()[i].getName() == cvlist[k].getName())
{ found = true;
break;}
}
if (found == false){
cvlist.push(folder.getFiles()[i].getBlob());
j++;
}
found = false;
}
if(cvlist.length>0){
var zip = Utilities.zip(cvlist, 'For_download.zip');
folder.createFile(zip);
}
}