如何压缩Google驱动器中的文件? [英] How to compress files in google drive?

查看:120
本文介绍了如何压缩Google驱动器中的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以将大文件压缩为Google驱动器中.tar.gz文件的较小.zip文件?我尝试了Google appscript ,但它创建了。 zip文件,但不压缩。

Is there any way to compress large files into smaller .zip of .tar.gz files in google drive? I tried google appscript but it created .zip files but not compressing. How to do this?

推荐答案

我尝试了以下代码,并使用了10MB大小的pdf文件来测试以下代码并且确实压缩了9MB。我什至测试了一个Drive文件(幻灯片),它的确压缩了它。

I have tried and tested the below code with a pdf file which is in my Drive of 10MB size and it did compressed it for 9MB. I even tested for a Drive file(slides), it did compress it.

function fileZip(){
 var files = DriveApp.getFilesByName('Google_Apps_Script_Second_Edition.pdf');
  while (files.hasNext()) {
    var file = files.next();
 file = file.getBlob()}

DriveApp.createFile(Utilities.zip([file], 'tutorialFiles.zip'));

}

希望有帮助!

这篇关于如何压缩Google驱动器中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆