[英]How to sync Google Cloud Storage bucket with local folder for offline usage?
[英]How to prevent the remove of a certain folder in a Google Cloud Storage Bucket?
我正在通過 Gitlab CI 將一些文件部署到 Google Cloud 中的 Bucket。 我用來刪除對象的命令是gsutil -m rm gs://pr.homefront.com
該命令會從存儲桶中刪除所有內容,但我想將其更改為每次運行該命令時仍然刪除該存儲桶中名為“ibw”的文件夾以外的所有內容。
您可以為文件夾中的對象添加臨時保留,這可以防止對該對象進行操作或刪除
您可以通過以下 gsutil 命令應用保留:
gsutil -m retention temp set gs://bucketname/ibw/*******
*每個星號是一個文件夾級別
您可以在 rm 命令之前設置保留,並在 rm 命令之后取消設置。 在刪除保留之前不能修改或刪除對象
更新:
可以將保留添加到空文件夾
#this block the empty folder, if this is an folder with files all files will be blocked
gsutil -m retention temp set gs://bucketname/ibw/*******
#this operation can't remove objects,and empty folders with holds
gsutil -m rm gs://bucketname
#remove the hold of the empty folder, if this is an folder with files all files will be released
gsutil -m retention temp release gs://bucketname/ibw/*******
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.