Try this code:
import httplib2
from googleapiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
scope = 'https://www.googleapis.com/auth/drive'
# `client_secrets.json` should be your credentials file, as generated by Google.
credentials = ServiceAccountCredentials.from_json_keyfile_name('client_secrets.json', scope)
http = httplib2.Http()
drive_service = build('drive', 'v3', http=credentials.authorize(http))
def createFolder(name):
file_metadata = {
'name': name,
'mimeType': 'application/vnd.google-apps.folder'
}
file = drive_service.files().create(body=file_metadata,
fields='id').execute()
print('Folder ID: %s' % file.get('id'))
createFolder('folder_name')
You will need to install oath2client, google-api-python-client and httplib2 via pip.
To check, all of the folders:
page_token = None
while True:
response = drive_service.files().list(q="mimeType='application/vnd.google-apps.folder'",
spaces='drive',
fields='nextPageToken, files(id, name)',
pageToken=page_token).execute()
for file in response.get('files', []):
# Process change
print('Found file: %s (%s)' % (file.get('name'), file.get('id')))
page_token = response.get('nextPageToken', None)
if page_token is None:
break
By the way:
The user cannot directly access data in the hidden app folders, only
the app can access them. This is designed for configuration or other
hidden data that the user should not directly manipulate. (The user
can choose to delete the data to free up the space used by it.)
The only way the user can get access to it is via some functionality
exposed by the specific app.
According to documentation
https://developers.google.com/drive/v3/web/appdata you can access,
download and manipulate the files if you want to. Just not though the
normal Google Drive UI.