Google Drive organizes files in collections, describes files by types, andprovides specific attributes for each file to facilitate file manipulation.
The Google Drive API represents files stored on Drive as aFile
resource.
Ownership
Drive organizes files based on the user's relationship with thecontent and its storage location. Collections are specified as part of thefile's metadata to show which group of files the file is stored with insideDrive. The main difference between My Drive andshared drive collections is file ownership. A single user is the owner of filesin their My Drive, whereas a group or organization owns files ina shared drive.
- My Drive
- Each user has a "root" folder called "MyDrive" that functions as their primary hierarchy, andconsists of everything that descends from this root folder. The user is theprimary owner of this folder.
- Shared drives
- A shared drive is anorganizational structure within Drive that lives parallel toMy Drive. You can organize an individual file within a shareddrive or My Drive, but not both. However, Drive shortcuts can be used topoint to files or folders from shared drives to My Drive, orvice versa.
File types
Drive describes files by types. This list shows all availablefile types:
- Blob
- A file that contains text or binary content such as images, videos, andPDFs.
- Folder
A container you can use to organize other types of files onDrive. Folders are files that only contain metadata, and havethe MIME type
application/vnd.google-apps.folder
.Note: A single file stored on My Drive can be containedin multiple folders. A single file stored on a shared drive can only have one parent folder.
- Shortcut
A metadata-only file that points to another file onDrive. The shortcut file MIME type is
application/vnd.google-apps.shortcut
. For more information, see Create ashortcut to a Drive file.- Third-party shortcut
A metadata-only file that links to content stored on athird-party storage system. The third-party shortcut file MIME type is
application/vnd.google-apps.drive-sdk
. For more information, see Create ashortcut to an external file.- Google Workspace document
A file that a Google Workspace applicationcreates, such as Google Docs, Sheets, or Slides. The MIME type format is
application/vnd.google-apps.*app*
where app is the application name(such asapplication/vnd.google-apps.spreadsheet
for a Google Sheetsfile). For a list of Drive and Google Workspace-specificMIME types, see Google Workspace & Google Drive supported MIME types.
Note: You cannot upload or download folders, shortcuts, third-partyshortcuts, and Google Workspace documents to or from Drive.However, if they use compatible formats you can upload or exportGoogle Workspace documents. For example, you can create a Google Doc when youimport a PDF. Similarly, you can export a Google Slides presentation as aMicrosoft PowerPoint file.
File characteristics
This list shows some characteristics of a Drive file:
- File ID
- A unique, opaque ID for each file. File IDs arestable throughout the life of the file, even if the file name changes.Search expressions are used to locate filesby name, type, content, parent container, owner, or other metadata.
- Metadata
- Data that describes the content of the file. This data includes thename, type, creation, and modification times. Some metadata fields, such asthe
name
, is user-agnostic and appears the same for each user. Otherfields, such ascapabilities
andviewedByMeDate
contain user-specificvalues. File types, such as images and videos, contain additional metadataextracted from EXIF and other embedded metadata. - Permission
- An access grant for a user, group, domain, or the world to accessa file or a folder hierarchy. Users control who can access a file with theaccess control list (ACL), which is a list of permissions for the file.For more information, see Share files, folders &drives.
- Content
- The binary or text body of the file. Some content examples you canstore in Google Drive are images, videos, text, and PDF.
- Revision history
- The record of changes to the file content only, not thefile metadata. For more details about revisions, see Changes and revisionsoverview.
- Thumbnail
- A graphical representation of a file. Driveautomatically generates thumbnails for many common file types. For shortcutsand other file types that Drive can't render, you can providea thumbnail image.
File organization
The Drive API organizes files into storage locations, called spaces
,and collections, called corpora
.
- Spaces
Specific storage locations that are isolated from each other. Allcontent in Drive is stored in one of these 2 defined spaces:
drive
andappDataFolder
.drive
—Includes all user-visible files created inDrive. PDFs, documents, Google Docs, shortcuts, andother content the user uploads is located in thedrive
space.appDataFolder
—Includes per-user application data. Applicationstypically store configuration files and other data not intended to bedirectly accessible by users.
Files cannot move between spaces.
- Corpora
Collections of files used to narrow the scope of file and foldersearches. The corpora for Drive are:
user
,domain
,drive
, andallDrives
.user
—Includes all files created by and opened by the user in "MyDrive", and those shared directly with the user in "Sharedwith me."drive
—Includes all files contained in a single shared drive, asindicated by thedriveId
.domain
—Includes all searchable files shared with the user'sdomain.allDrives
—Includes all files in shared drives where the user isa member, and all files in "My Drive" and "Shared with me."Use theallDrives
corpora with caution as it has a broad scope and canaffect performance. When possible, useuser
ordrive
instead ofallDrives
for efficiency.
Files can move freely between corpora as permissions and ownership change.
Next steps
Here are a few next steps you might take:
- Learn how to Upload file data toDrive.
- Learn how to Download & export files fromDrive.
- Learn how to Store application-specific data.
- Learn how to Display the Google Picker on a page.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-03 UTC.
[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }] [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]