About Files and Folders

All content in Drive is represented as a File. Files are comprised of metadata and content and can be inserted, updated, copied, and deleted.

File basics

File IDs

Each file is identified by a unique opaque ID. File IDs are stable throughout the life of the file, even if the file name changes.

Files in Drive can not be directly addressed by their path. Search expressions are used to locate files by name, type, content, parent container, owner, or other metadata.

Metadata

Each file contains metadata describing the content. This includes the file name, type, creation and modification times. Some metadata fields like the file name are user-agnostic and appear the same for each user. Others, such as capabilities and viewedByMeDate contain per-user values.

File types such as images and videos contain additional metadata extracted from EXIF and other embedded metadata.

Permissions

All files are owned by users. Users control who else can access their files through access control lists, represented as a list of Permissions for each file.

Additional details about ACLs are available in the permissions guide.

Content

Files may have associated binary or text content that can be uploaded or downloaded. Images, videos, text files, PDFs are examples of files that have content stored in Drive.

Content for many common formats is indexed by Drive. This includes both text content as well as images. Drive use both optical character recognition (OCR) as well as machine learning to identify objects and places in images.

If your app saves other types of files (drawings, video, shortcuts), you can improve the discoverability by supplying indexable text during upload.

Revisions

Files also contain a revision history of their associated content. Revisions are not stored indefinitely and may be purged as needed. Important revisions may be pinned to prevent purging.

Thumbnails

Drive automatically generates thumbnails for many common file types. For shortcuts and other file types that Drive can't render, you can provide a thumbnail image generated by your application.

File types

While all files are represented with the same File structure, their behaviors and features vary depending on the type of the file.

Blobs

Blobs are files that contain text or binary content such as images, videos, and PDFs. Blob content can be uploaded or downloaded as is, or in some cases, converted to Google Docs, Sheets, or Slides.

Folders

Folders are containers used for organizing user content in Drive. They are represented as files with the MIME type application/vnd.google-apps.folder. Folders only contain metadata and can not be uploaded or downloaded. However, they can act as parents for other files and folders.

Files located under "My Drive" can be contained in multiple folders. Files in Team Drives can only have one parent folder.

Shortcuts

Shortcuts are special files used to link 3rd party content to Drive. They are represented as files with the MIME type application/vnd.google-apps.drive-sdk. Shortcuts only contain metadata. They can not be uploaded or downloaded through Drive.

Google documents

Files from Google Docs, Sheets, Slides, and other apps are similar to shortcuts. They are represented as files with MIME types in the form application/vnd.google-apps.<app>. Like shortcuts, they can neither be directly uploaded or downloaded.

Content may be imported or exported via compatible formats. For example, a Google Doc can be created by uploading a PDF or a Google Slides presentation can be exported to a .pptx file.

发送以下问题的反馈:

此网页
Drive REST API
Drive REST API