โฟลเดอร์ คือไฟล์ที่มีเฉพาะข้อมูลเมตาและใช้เพื่อจัดระเบียบไฟล์ได้ ใน Google ไดรฟ์ โดยมีคุณสมบัติต่อไปนี้
- โฟลเดอร์คือไฟล์ที่มีประเภท MIME
application/vnd.google-apps.folder
และไม่มีส่วนขยาย - ชื่อแทน
root
สามารถใช้เพื่ออ้างถึงโฟลเดอร์รูทที่ใดก็ได้ที่มีรหัสไฟล์ ให้ไว้
โปรดดูข้อมูลเพิ่มเติมเกี่ยวกับขีดจำกัดของโฟลเดอร์ในไดรฟ์ได้ที่ไฟล์และโฟลเดอร์ ขีดจำกัดของโฟลเดอร์
คำแนะนำนี้จะอธิบายวิธีทำงานพื้นฐานบางอย่างที่เกี่ยวข้องกับโฟลเดอร์
สร้างโฟลเดอร์
หากต้องการสร้างโฟลเดอร์ ให้ใช้files.create
ที่มี application/vnd.google-apps.folder
MIME
ประเภทและชื่อ ตัวอย่างโค้ดต่อไปนี้แสดง
วิธีสร้างโฟลเดอร์โดยใช้ไลบรารีของไคลเอ็นต์
Java
Python
Node.js
PHP
.NET
สร้างไฟล์ในโฟลเดอร์ที่ระบุ
หากต้องการสร้างไฟล์ในโฟลเดอร์ที่เฉพาะเจาะจง ให้ใช้เมธอด files.create
และระบุรหัสโฟลเดอร์ใน
พร็อพเพอร์ตี้ parents
ของไฟล์
พร็อพเพอร์ตี้ parents
จะมีรหัสของโฟลเดอร์หลักที่มีไฟล์นั้นอยู่
คุณสามารถใช้พร็อพเพอร์ตี้ parents
เมื่อสร้างไฟล์ในโฟลเดอร์ระดับบนสุดหรือ
โฟลเดอร์อื่นๆ
ไฟล์หนึ่งๆ จะมีโฟลเดอร์หลักได้เพียงโฟลเดอร์เดียว การระบุรายการหลักหลายรายการไม่ใช่ ที่รองรับ
ตัวอย่างโค้ดต่อไปนี้แสดงวิธีสร้างไฟล์ในโฟลเดอร์ที่ระบุโดยใช้ ไลบรารีของไคลเอ็นต์
Java
Python
Node.js
PHP
.NET
ย้ายไฟล์ระหว่างโฟลเดอร์
หากต้องการย้ายไฟล์ คุณต้องอัปเดตรหัสของพร็อพเพอร์ตี้ parents
หากต้องการเพิ่มหรือนำรายการหลักออกจากไฟล์ที่มีอยู่ ให้ใช้เมธอด files.update
กับ addParents
และ
พารามิเตอร์การค้นหา removeParents
ไฟล์หนึ่งๆ จะมีโฟลเดอร์หลักได้เพียงโฟลเดอร์เดียว การระบุรายการหลักหลายรายการไม่ใช่ ที่รองรับ
ตัวอย่างโค้ดต่อไปนี้แสดงวิธีย้ายไฟล์ระหว่างโฟลเดอร์โดยใช้ ไลบรารีของไคลเอ็นต์:
Java
Python
Node.js
PHP
.NET
ขีดจำกัดของไฟล์และโฟลเดอร์
ไฟล์และโฟลเดอร์ในไดรฟ์มีขีดจํากัดของพื้นที่เก็บข้อมูลบางส่วน
ขีดจำกัดรายการผู้ใช้
ผู้ใช้แต่ละคนจะมีรายการต่างๆ ที่บัญชีนั้นสร้างขึ้นได้สูงสุด 500 ล้านรายการ เมื่อถึงขีดจำกัดแล้ว ผู้ใช้จะสร้างหรืออัปโหลดรายการใน ไดรฟ์ แต่ยังดูและแก้ไขรายการที่มีอยู่ได้ วิธีสร้าง ไฟล์อีกครั้ง ผู้ใช้ต้องลบรายการอย่างถาวรหรือใช้บัญชีอื่น สำหรับ โปรดดูข้อมูลเพิ่มเติมที่ถังขยะหรือลบไฟล์และ โฟลเดอร์
ออบเจ็กต์ที่นับรวมในขีดจำกัดนี้ ได้แก่
- รายการที่ผู้ใช้สร้างหรืออัปโหลดในไดรฟ์
- รายการที่ผู้ใช้สร้างแต่ขณะนี้เป็นของคนอื่น
- รายการในถังขยะ
- ทางลัด
- แป้นพิมพ์ลัดของบุคคลที่สาม
ออบเจ็กต์ที่ไม่นับรวมในขีดจำกัดนี้ ได้แก่
- รายการที่ลบถาวร
- รายการที่แชร์กับผู้ใช้แต่เป็นของผู้อื่น
- รายการของผู้ใช้แต่เป็นบุคคลอื่น
การพยายามเพิ่มรายการมากกว่า 500 ล้านรายการจะส่งคืน
activeItemCreationLimitExceeded
การตอบกลับรหัสสถานะ HTTP
โปรดทราบว่าแม้จะไม่มีการจำกัดจำนวนรายการที่บัญชีบริการเข้าถึงได้ ขีดจำกัด 500 ล้านรายการจะมีผลกับจำนวนรายการที่บัญชีบริการ ที่สามารถสร้างได้
ขีดจำกัดรายการโฟลเดอร์
แต่ละโฟลเดอร์ใน "ไดรฟ์ของฉัน" ของผู้ใช้จะมีขีดจำกัดอยู่ที่ 500,000 รายการ ขีดจำกัดนี้จะไม่มีผลกับโฟลเดอร์รูทของไดรฟ์ของฉัน รายการ ที่นับรวมอยู่ในขีดจำกัดนี้ ได้แก่
- โฟลเดอร์
- ไฟล์ ไฟล์ทุกประเภท ไม่ว่าจะเป็นเจ้าของไฟล์แบบใดก็ตาม
- ทางลัด นับเป็น 1 รายการในโฟลเดอร์ แม้ว่ารายการนั้นจะ ชี้ไปยัง ไม่อยู่ในโฟลเดอร์นั้น สำหรับข้อมูลเพิ่มเติม โปรดดูที่สร้าง ทางลัดไปยังไฟล์ในไดรฟ์
- แป้นพิมพ์ลัดของบุคคลที่สาม นับเป็นรายการเดียวภายในโฟลเดอร์ แม้ว่า รายการที่ชี้ไปที่ ไม่อยู่ในโฟลเดอร์นั้น สำหรับข้อมูลเพิ่มเติม โปรดดู สร้างไฟล์ทางลัดไปยังเนื้อหาที่จัดเก็บโดย แอป
สำหรับข้อมูลเพิ่มเติมเกี่ยวกับขีดจำกัดของโฟลเดอร์ โปรดดูขีดจำกัดของโฟลเดอร์ใน Google ไดรฟ์
ขีดจำกัดความลึกของโฟลเดอร์
ไดรฟ์ของฉันของผู้ใช้จะมีระดับที่ซ้อนกันได้ไม่เกิน 100 ระดับ
โฟลเดอร์ ซึ่งหมายความว่าระบบจะไม่เก็บโฟลเดอร์ย่อยไว้ในโฟลเดอร์ที่
มีความลึกมากกว่า 99 ระดับ ข้อจำกัดนี้จะมีผลกับโฟลเดอร์ย่อยเท่านั้น เด็ก
ที่มีประเภท MIME ที่ไม่ใช่
application/vnd.google-apps.folder
ได้รับการยกเว้นจากข้อจำกัดนี้
ตัวอย่างเช่น ในแผนภาพต่อไปนี้ โฟลเดอร์ใหม่สามารถฝังไว้ในโฟลเดอร์ได้ หมายเลข 99 แต่ไม่อยู่ในโฟลเดอร์หมายเลข 100 แต่โฟลเดอร์หมายเลข 100 สามารถเก็บข้อมูล เช่นเดียวกับโฟลเดอร์ไดรฟ์อื่นๆ
การพยายามเพิ่มโฟลเดอร์มากกว่า 100 ระดับจะแสดงผล
myDriveHierarchyDepthLimitExceeded
การตอบกลับรหัสสถานะ HTTP