You can view folder details, update display names, move folders, and delete unneeded folders using the Cloud de Confiance console, the Google Cloud CLI, or the Cloud Resource Manager API. Managing folders lets you organize your resources and maintain your Cloud de Confiance by S3NS resource hierarchy as projects and teams evolve.
List folders and view folder details
To list folders or to view metadata for a specific folder, such as its display name, parent ID, and
lifecycle state, you must have the Folder Viewer role (roles/resourcemanager.folderViewer)
or the Organization Viewer role (roles/resourcemanager.organizationViewer).
Console
In the Cloud de Confiance console, open the Manage resources page.
The resource list displays your hierarchy as a table. Select your organization resource.
Click the arrow next to the organization name to expand the tree view and see its child folders.
To perform actions, such as moving, deleting, or viewing settings, click the Actions at the end of the row for that specific resource.
Use the Filter bar at the top of the resource list to search for resources by name, ID, or label.
For information about how the Manage resources page calculates the Last accessed timestamp for folders and projects, see Understand the Last accessed timestamp.
Using the project picker
The project picker is located in the navigation bar and isn't part of the main Resource Manager page interface. Use it to switch your active global context to a specific project or folder.
Click the project picker. In the dialog that appears, select your organization from the drop-down to filter the results.
Browse the hierarchy or search for the project or folder you want to switch to. Clicking a resource in this picker changes your global context, affecting which resources are visible in other service pages (like Compute Engine or Cloud Storage).
gcloud
To get details of one folder, use the
gcloud resource-manager folders describe
command:
gcloud resource-manager folders describe FOLDER_ID
Replace FOLDER_ID with the ID of the folder you want
to view.
To list the child folders of an organization resource, use the
gcloud resource-manager folders list
command:
gcloud resource-manager folders list \
--organization=ORGANIZATION_ID
Replace ORGANIZATION_ID with the ID of the
organization resource for which you want to see a list of child folders.
To list the child folders of a folder resource, use the
gcloud resource-manager folders list
command:
gcloud resource-manager folders list \
--folder=FOLDER_ID
Replace FOLDER_ID with the ID of the
folder resource for which you want to see a list of child folders.
To list the projects under an organization or folder resource, use the
gcloud projects list command with
the --filter flag:
gcloud projects list \
--filter="parent.id='RESOURCE_ID'"
Replace RESOURCE_ID with the ID of the
organization or folder resource for which you want to see a list of child
projects.
REST
The curl request to get folders:
curl -X GET -H "Content-Type: application/json" \
-H "Authorization: Bearer ${bearer_token}" \
https://cloudresourcemanager.googleapis.com/v3/FOLDER_ID
Replace FOLDER_NAME with the name of the folder, such as folders/123.
The curl request to list folders:
curl -X GET -H "Content-Type: application/json" \
-H "Authorization: Bearer ${bearer_token}" \
https://cloudresourcemanager.googleapis.com/v3/folders?parent=PARENT_NAME
Replace PARENT_NAME with the name of the parent resource
under which you're creating the folder, such as organizations/123 or folders/123.
Update folders
To update a folder's display name, you must have the Folder Editor role (roles/resourcemanager.folderEditor)
or the Folder Admin role (roles/resourcemanager.folderAdmin) on the folder.
Console
In the Cloud de Confiance console, open the Manage resources page.
Click the arrow next to the organization name to expand the tree view and see its child folders.
In the row of the folder you want to update, click the Actions menu at the end of the row, and click Settings.
Enter the new folder name and click Save.
gcloud
To update a folder's display name, use the
gcloud resource-manager folders update
command:
gcloud resource-manager folders update FOLDER_ID \ --display-name="NEW_DISPLAY_NAME"
Replace the following:
FOLDER_ID: the ID of the folder you want to update.NEW_DISPLAY_NAME: the new display name for the folder.
REST
Before using any of the request data, make the following replacements:
- FOLDER_ID: the Cloud de Confiance by S3NS folder ID
- NEW_DISPLAY_NAME: the new display name for the folder
HTTP method and URL:
PATCH https://cloudresourcemanager.googleapis.com/v3/folders/FOLDER_ID?updateMask=displayName
Request JSON body:
{
"displayName": "NEW_DISPLAY_NAME"
}
To send your request, choose one of these options:
curl
Save the request body in a file named request.json,
and execute the following command:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://cloudresourcemanager.googleapis.com/v3/folders/FOLDER_ID?updateMask=displayName"
PowerShell
Save the request body in a file named request.json,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://cloudresourcemanager.googleapis.com/v3/folders/FOLDER_ID?updateMask=displayName" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{
"name": "operations/fc.1234567890abcdef",
"metadata": {
"@type": "type.googleapis.com/google.cloud.resourcemanager.v3.FolderOperationMetadata",
"displayName": "NEW_DISPLAY_NAME",
"operationType": "UPDATE",
"resourceName": "folders/FOLDER_ID"
},
"done": false
}
Move a folder into another folder
To move a folder into another folder, you must have the resourcemanager.folders.move permission for both the source and destination folders.
Console
The process of moving folders into other folders in the console is similar to moving projects.
- In the Cloud de Confiance console, open the Manage resources page.
- Select your organization resource from the Organization drop-down on the top left of the page.
- Click your folder's row to select your folder from the list of projects and folders.
- Click the options menu (the vertical ellipsis) in the row and click Move.
- Click Browse to select the folder to which you want to move the folder.
- Click Move.
gcloud
To move a folder under the organization resource, run the following command in the Google Cloud CLI:
gcloud resource-manager folders move FOLDER_ID \ --organization=PARENT_ID
Replace the following:
FOLDER_ID: the ID of the folder you want to move.PARENT_ID: the ID of the parent organization resource.
To move a folder under another folder:
gcloud resource-manager folders move FOLDER_ID \ --folder=PARENT_ID
Replace the following:
FOLDER_ID: the ID of the folder you want to move.PARENT_ID: the ID of the parent folder.
REST
The request JSON:
request_json= '{
destinationParent: "folders/DESTINATION_FOLDER_ID"
}'
The Move Folder curl request:
curl -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer ${bearer_token} \
-d "$request_json" \
https://cloudresourcemanager.googleapis.com/v3/folders/DISPLAY_NAME:move
Replace the following:
- DESTINATION_FOLDER_ID: the ID of the folder under which you're
moving another folder, for example
98765. - DISPLAY_NAME: the display name of the folder being moved, for example "My Awesome Folder."
The Move Folder response:
{
"name": "operations/fm.1234567890",
"metadata": {
"@type": "type.googleapis.com/google.cloud.resourcemanager.v3.FolderOperation",
"displayName": "DISPLAY_NAME",
"operationType": "MOVE"
}
}
The Get Operation curl request:
curl -H "Authorization: Bearer ${bearer_token}" \
https://cloudresourcemanager.googleapis.com/v3/operations/fm.1234567890
The Get Operation response:
{
"name": "operations/fm.1234567890",
"metadata": {
"@type": "type.googleapis.com/google.cloud.resourcemanager.v3.FolderOperation",
"displayName": "DISPLAY_NAME",
"operationType": "MOVE"
},
"done": true,
"response": {
"@type": "type.googleapis.com/google.cloud.resourcemanager.v3.Folder",
"name": "folders/12345",
"parent": "folders/98765",
"displayName": "DISPLAY_NAME",
"lifecycleState": "ACTIVE",
"createTime": "2017-07-19T23:29:26.018Z",
"updateTime": "2017-07-20T00:54:44.295Z"
}
}
Delete folders
To delete a folder, you must have the Folder Editor role (roles/resourcemanager.folderEditor)
or the Folder Admin role (roles/resourcemanager.folderAdmin) on the folder.
Console
In the Cloud de Confiance console, open the Manage resources page.
In the Cloud de Confiance console, go to the Manage resources page.Click the arrow next to the organization name to expand the tree view and see its child folders.
In the row of the folder you want to delete, click the Actions menu at the end of the row, and click Delete.
In the confirmation dialog, type the folder ID or name to confirm and click Delete.
gcloud
To delete a folder, run the following command:
gcloud resource-manager folders delete FOLDER_ID
Replace the following:
FOLDER_ID: the ID of the folder you want to delete.
REST
Before using any of the request data, make the following replacements:
- FOLDER_ID: the Cloud de Confiance by S3NS folder ID
HTTP method and URL:
DELETE https://cloudresourcemanager.googleapis.com/v3/folders/FOLDER_ID
To send your request, choose one of these options:
curl
Execute the following command:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://cloudresourcemanager.googleapis.com/v3/folders/FOLDER_ID"
PowerShell
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://cloudresourcemanager.googleapis.com/v3/folders/FOLDER_ID" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{
"name": "operations/fc.1234567890abcdef",
"metadata": {
"@type": "type.googleapis.com/google.cloud.resourcemanager.v3.FolderOperationMetadata",
"operationType": "DELETE",
"resourceName": "folders/FOLDER_ID"
},
"done": false
}
Additional information
When you delete a folder, it enters a soft-deleted state for a 30-day retention period before being permanently deleted, or hard-deleted.
Soft-delete state: During the 30-day retention period, the folder is marked for deletion and is no longer active. You can't create new projects or sub-folders within a soft-deleted folder.
Hard-delete state: After 30 days, Cloud de Confiance by S3NS permanently removes the folder and its metadata. This action is irreversible.
Undelete: If you accidentally delete a folder, you can restore it within the
30-day window using the gcloud resource-manager folders undelete command or
the API.
Prerequisites and constraints
- Folder must be empty: You can't delete a folder that still contains active projects or sub-folders. You must first move or delete all child resources.
- Required permissions: To delete or undelete a folder, you must have the
Folder Editor (
roles/resourcemanager.folderEditor) or Folder Admin (roles/resourcemanager.folderAdmin) role.
Search
To search for folders that match a specific query, use the
gcloud alpha resource-manager folders search
command and pass your search condition in the --query flag. The search scope
includes all folders that you have permission to view.
For example, to search for folders with display names that start with vij,
such as vijeta or vijay-folder, run the following command:
gcloud alpha resource-manager folders search --query="displayName:vij*"
To search for folders that are pending deletion, run the following command:
gcloud alpha resource-manager folders search --query="state:DELETE_REQUESTED"
To return all folders that you have permission to view, run the
gcloud alpha resource-manager folders search command without the --query
flag:
gcloud alpha resource-manager folders search
What's next
- Learn about managing projects within folders.
- Learn about roles and permissions for folders.