Description:
Copy files in a storage bucket to the local, or local files to a storage bucket.
Syntax:
gcs_copy(fd,bucket:key, [localFile])
Note:
External library function (See External Library Guide).
Parameter:
fd |
GCS connection object |
bucket |
Storage bucket name |
key |
File name in the storage bucket |
localFile |
A local file name; save the file in the main directory by default |
Option:
@u |
Copy a local file to a GCS storage bucket; when the local file path is a relative path, it is relative to the main directory |
Return value:
Boolean value
Example:
|
A |
|
1 |
=file("F:/gcs.json").read() |
|
2 |
=gcs_open(A1) |
Connect to the GCS service. |
3 |
=gcs_copy(A2, "test1":"test1.txt") |
Copy test.txt in storage bucket test1 to【main directory】/test1. |
4 |
=gcs_copy(A2, "test1":"test1.txt","D:/myBucket/test2.txt") |
Copy test.txt in storage bucket test1 to the local directory D:/myBucket/test2.txt. |
5 |
=gcs_copy@u(A2, "test1":"test3.txt","D:/myBucket/test2.txt") |
Copy the local file D:/myBucket/test2.txt to test3.txt in storage bucket test1. |
6 |
>gcs_close(A2) |
|