gcloud alpha storage rm [URLS …] [--additional-headers=HEADER=VALUE] [--all-versions, -a] [--continue-on-error, -c] [--exclude-managed-folders] [--read-paths-from-stdin, -I] [--recursive, -R, -r] [--if-generation-match=GENERATION --if-metageneration-match=METAGENERATION] [GCLOUD_WIDE_FLAG …]
(ALPHA) Delete objects and buckets.
my-object from the bucket
my-bucket:
gcloud alpha storage rm gs://my-bucket/my-object
The following command deletes all objects directly within the directory
but no objects within
subdirectories:
my-dir
gcloud alpha storage rm gs://my-bucket/my-dir/*
The following command deletes all objects and subdirectories within the
directory :
my-dir
gcloud alpha storage rm gs://my-bucket/my-dir/**
Note that for buckets that contain versioned
objects, the above command only affects live versions. Use the
--recursive flag instead to delete all versions.
The following command deletes all versions of all resources in
and then deletes the bucket.
my-bucket
gcloud alpha storage rm --recursive gs://my-bucket/
The following command deletes all text files in the top-level of
, but not text files in
subdirectories:
my-bucket
gcloud alpha storage rm -recursive gs://my-bucket/*.txtThe following command deletes one wildcard expression per line passed in by stdin:
some_program | gcloud alpha storage rm -IURLS …]--additional-headers=HEADER=VALUEheader1=value1,header2=value2. Overrides
the default storage/additional_headers property value for this
command invocation.
--all-versions, -a--continue-on-error, -c--exclude-managed-folders--read-paths-from-stdin, -I--recursive, -R, -rgs://bucket, the
bucket is also deleted. This option implies the --all-versions
option. If you want to delete only live object versions, use the
``**´´ wildcard instead.
--if-generation-match=GENERATION--if-metageneration-match=METAGENERATION--access-token-file,
--account, --billing-project,
--configuration,
--flags-file,
--flatten, --format, --help, --impersonate-service-account,
--log-http,
--project, --quiet, --trace-token, --user-output-enabled,
--verbosity.
Run $ gcloud help for details.
gcloud storage rm
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 2026-05-27 UTC.