mv - Move/rename objects and/or subdirectories

mv - Move/rename objects and/or subdirectories


gsutil mv [-p] src_url dst_url
gsutil mv [-p] src_url... dst_url
gsutil mv [-p] -I dst_url


The gsutil mv command allows you to move data between your local file system and the cloud, move data within the cloud, and move data between cloud storage providers. For example, to move all objects from a bucket to a local directory you could use:

gsutil mv gs://my_bucket/* dir

Similarly, to move all objects from a local directory to a bucket you could use:

gsutil mv ./dir gs://my_bucket

Renaming Bucket Subdirectories

You can use the gsutil mv command to rename subdirectories. For example, the command:

gsutil mv gs://my_bucket/olddir gs://my_bucket/newdir

would rename all objects and subdirectories under gs://my_bucket/olddir to be under gs://my_bucket/newdir, otherwise preserving the subdirectory structure.

If you do a rename as specified above and you want to preserve ACLs, you should use the -p option (see OPTIONS).

Note that when using mv to rename bucket subdirectories you cannot specify the source URL using wildcards. You need to spell out the complete name:

gsutil mv gs://my_bucket/olddir gs://my_bucket/newdir

If you have a large number of files to move you might want to use the gsutil -m option, to perform a multi-threaded/multi-processing move:

gsutil -m mv gs://my_bucket/olddir gs://my_bucket/newdir

Non-Atomic Operation

Unlike the case with many file systems, the gsutil mv command does not perform a single atomic operation. Rather, it performs a copy from source to destination followed by removing the source for each object.

A consequence of this is that, in addition to normal network and operation charges, if you move a Nearline Storage or Coldline Storage object, deletion and data retrieval charges apply. See the documentation for pricing details.


All options that are available for the gsutil cp command are also available for the gsutil mv command (except for the -R flag, which is implied by the gsutil mv command). Please see the OPTIONS sections of gsutil help cp for more information.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Storage Documentation