Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function compressMonth() {
- var month = '07';
- var year = '2017';
- var idOriginFolder = 'ABCDEfesn4342322';
- var originFolder = DriveApp.getFolderById(idOriginFolder);
- var nameCompressedFile = originFolder.getName()+year+' '+month+'.zip';
- var searchString = '"'+idCarpetaOrigen+'" in parents and modifiedDate >= "'+year+'-'+month+'-01T00:00:00-03:00" and modifiedDate <= "'+year+'-'+month+'-'+'28T23:59:59-03:00"';
- var foundFiles = DriveApp.searchFiles(searchString);
- var blobIndex = [];
- var fileBlob = null;
- while (foundFiles.hasNext()){
- fileBlob = foundFiles.next().getBlob();
- blobIndex.push(fileBlob);
- }
- var compressedFolder = Utilities.zip(blobIndex,nameCompressedFile);
- originFolder.createFile(compressedFolder);
- }
Add Comment
Please, Sign In to add comment