在Google Cloud Storage Bucket中,我正在尝试将文件从其原始文件夹移至存档文件夹。一旦文件移动“成功”完成,我想从其原始文件夹中删除文件。
## Assigning the bucket to the bucket object
bucket = storage.Bucket(<Bucket_Name>)
## Enumerating and finding the required file object in the bucket and
##assigning that to my_file object
for obj in bucket.objects():
if obj.key.find(<file_name>) > 0:
my_file = obj
print(my_file.key)
## Taking the current timestamp
timestamp = str(datetime.now())
## Copying the file to the new location
my_file.copy_to( <archive folder> + <file name> + <timestamp>)
我现在要在删除文件对象之前检查“ my_file.copy_to()”是否已成功执行。我该如何检查?