-
-
Save 9werayut/51c3cb4695abecc105a938df30f8d566 to your computer and use it in GitHub Desktop.
แปล จาก original post https://gist.github.com/fonylew/480ab35656572c5341510b59785ac2e8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# สร้าง bucket | |
gsutil mb gs://[BUCKET] | |
# ลิสต์ files ใน bucket | |
gsutil ls gs://[BUCKET] | |
# ดูว่า bucket ขนาดเท่าไร (du: disk usage) | |
gsutil du -sh gs://[BUCKET] | |
# Copy (upload) ไฟล์ไปยัง bucket | |
gsutil cp [File] gs://[BUCKET] | |
# > การ upload ไม่จำเป็นต้องสร้าง directory ล่วงหน้า | |
gsutil cp [File] gs://[BUCKET]/path/to/file | |
# > การ copy (upload) ทั้ง directory (-r) | |
gsutil cp -r [Folder] gs://[BUCKET] | |
# > การใช้ enable multiprocessing (-m) ช่วยให้ copy ไฟล์ได้เร็วขึ้น | |
gsutil -m cp -r [Folder] gs://[BUCKET] | |
# > การ copy (download) ไฟล์จาก bucket | |
gsutil cp gs://[BUCKET]/path/to/file [File] | |
# > การ copy (download) directory มายัง current directory | |
gsutil -m cp -r gs://[BUCKET]/path . | |
# > copy (download) เฉพาะไฟล์ txt มายัง current directory | |
gsutil -m cp gs://[BUCKET]/*.txt . | |
# Move หรือ rename ไฟล์ | |
gsutil mv gs://[BUCKET]/path/to/old_name gs://[BUCKET]/path/to/new_name | |
# Remove ลบไฟล์ file หรือ directory | |
# > remove การลบไฟล์ | |
gsutil rm gs://[BUCKET]/path/to/file | |
# > remove การลบ directory | |
gsutil rm -r gs://[BUCKET]/path/to/directory | |
# Doc: https://cloud.google.com/storage/docs/how-to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Upload https://cloud.google.com/storage/docs/samples/storage-upload-file#storage_upload_file-python
Download https://cloud.google.com/storage/docs/downloading-objects#storage-download-object-python