Guest User

Untitled

a guest
Apr 26th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. function compressMonth() {
  2. var month = '07';
  3. var year = '2017';
  4. var idOriginFolder = 'ABCDEfesn4342322';
  5. var originFolder = DriveApp.getFolderById(idOriginFolder);
  6. var nameCompressedFile = originFolder.getName()+year+' '+month+'.zip';
  7.  
  8. var searchString = '"'+idCarpetaOrigen+'" in parents and modifiedDate >= "'+year+'-'+month+'-01T00:00:00-03:00" and modifiedDate <= "'+year+'-'+month+'-'+'28T23:59:59-03:00"';
  9. var foundFiles = DriveApp.searchFiles(searchString);
  10. var blobIndex = [];
  11. var fileBlob = null;
  12. while (foundFiles.hasNext()){
  13. fileBlob = foundFiles.next().getBlob();
  14. blobIndex.push(fileBlob);
  15. }
  16. var compressedFolder = Utilities.zip(blobIndex,nameCompressedFile);
  17. originFolder.createFile(compressedFolder);
  18. }
Add Comment
Please, Sign In to add comment