简体   繁体   English

将文件夹上传到Google云端存储

[英]Upload folder to Google Cloud Storage

I would like to upload a folder with more than 100,000 files (more than 30GB), from my remote server to Google Cloud Storage. 我想从我的远程服务器上传一个包含超过100,000个文件(超过30GB)的文件夹到Google云端存储。 On the server I have I can not install gsutil. 我在服务器上无法安装gsutil。 Is there a better way to upload the files? 有没有更好的上传文件的方法? Using the API, that's how it is. 使用API​​,就是这样。

 $files = scanDir::scan("../../system_flex/Faturas/Media/", false, true);

$data = array();
foreach ($files as $file) {
    $arquivo = str_replace("//", "/", str_replace("../../system_flex/Faturas/", "", str_replace("\\", "/", $file)));
    $upload = $bucket->upload(
       fopen($file, 'r'), array( 'name' => $arquivo )
    );
}

That way it creates many requests and is slow, is there any other way maybe using PHP or some program? 这样它创建了许多请求并且速度很慢,有没有其他方式可能使用PHP或某些程序?

Move file remote server to google cloud storage is taken less time so you can use above code. 将文件远程服务器移动到谷歌云存储所花费的时间更少,因此您可以使用上述代码。

i tested 我测试过

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM