使用gsutil保存path复制文件列表(-I标志)
我正在尝试将所有图片和静态文件复制到Google Cloud Platform中的一个桶中。 我从我的应用程序的根目录试图这个命令: find -regextype posix-extended -iregex ".*\.(js|css|png|jpg|gif|ttf|cur|woff|eot)" | gsutil -m cp -I gs://example-bucket/ 而我的文件是这样的文件夹,例如: ./pictures/bg/img.png ./pictures/pictures/dog.jpg ./fonts/modern.woff gsutil命令中的标志-I指示它从stdin加载文件列表,标志-m只是使multithreading上传。 这一切工作正常,我看到我的文件在桶中,但是,所有文件丢失原来的path,并发送到桶的根,如下所示: gs://example-bucket/img.png gs://example-bucket/dog.jpg gs://example-bucket/modern.woff 想要的结果是这样的: gs://example-bucket/pictures/bg/img.png gs://example-bucket/pictures/pictures/dog.jpg gs://example-bucket/fonts/modern.woff 我希望这些文件保留原来的path。 我也尝试了这一点,我得到了同样的结果: gsutil -m cp -r ./**/*.{js,css,png,jpg,gif,ttf,cur,woff,eot} gs://example-bucket/ 似乎工作的唯一的东西是做一个for循环 for ..get-files.. begin gsutil cp $i gs://example-bucket/$i end 并且 find ..find-expr.. -exec gsutil cp {} gs://example-bucket/{} 但是这两个对我的工作stream来说太慢了。 在此先感谢您的帮助。