首页 > 解决方案 > 无法打开当前工作目录的路径:尝试在 gcloud 中运行 rsync 命令两次时权限被拒绝

问题描述

我正在尝试将数据从 复制file storesgoogle cloud bucket.

这是我正在使用的命令:

 gsutil rsync -r /fileserver/demo/dir1 gs://corp-bucket

corp-bucket: Name of my bucket
/fileserver/demo/dir1: Mount point directory (This directory contain the data of the file store)

此命令在第一次运行良好,它将目录的数据复制/fileserver/demo/dir1到云存储桶,但随后我从云存储桶中删除数据并再次运行相同的命令而不进行任何更改,然后我收到此错误:

cannot open path of the current working directory: Permission denied

注意:如果我对 /fileserver/demo/dir1 的文件进行了微小的更改并运行上述命令,那么它再次运行正常,但我的问题是为什么它在没有任何更改的情况下无法正常工作,有没有办法复制文件不做任何改变

谢谢。

标签: google-cloud-platform

解决方案


您可能遇到了rsync 的限制#2 “gsutil rsync 命令仅考虑源和目标存储桶中的活动对象版本”;您可以使用该模式排除 /dir1...-x并且仍然让 rsync 将清理工作作为常规同步过程。

复制这些文件的另一种方法是使用cpwith-r选项以递归方式代替 rsync。


推荐阅读