ó
ôBQc @ s@ d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d
l m
Z
d d l m Z d d l
m Z d d
l
m Z d d l
m Z d d l
m Z d d l
m Z d d l
m Z d d l m Z d Z d e f d „ ƒ YZ d S( iÿÿÿÿ( t Command( t COMMAND_NAME( t COMMAND_NAME_ALIASES( t CONFIG_REQUIRED( t FILE_URIS_OK( t MAX_ARGS( t MIN_ARGS( t PROVIDER_URIS_OK( t SUPPORTED_SUB_ARGS( t URIS_START_ARG( t CommandException( t HELP_NAME( t HELP_NAME_ALIASES( t HELP_ONE_LINE_SUMMARY( t HELP_TEXT( t HelpType( t HELP_TYPE( t NO_MAXs
SYNOPSIS
gsutil mv [-p] src_uri dst_uri
- or -
gsutil mv [-p] uri... dst_uri
DESCRIPTION
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 URI 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.
OPTIONS
-p Causes ACL to be preserved when moving in the cloud. Note that
this option has performance and cost implications, because it
is essentially performing three requests (getacl, cp, setacl).
(The performance issue can be mitigated to some degree by
using gsutil -m cp to cause multi-threaded/multi-processing
copying.)
t MvCommandc B s— e Z d Z i d e 6d d d g e 6d e 6e e 6d e 6e e
6e e 6d e
6e e 6Z i d e 6d d g e 6e j e 6d e 6e e 6Z d „ Z RS(
sŸ Implementation of gsutil mv command.
Note that there is no atomic rename operation - this command is simply
a shorthand for 'cp' followed by 'rm'.
t mvt movet rent renamei t pvi s) Move/rename objects and/or subdirectoriesc C s® xP | j d d !D]> } | j j | ƒ j ƒ r t d | | j d f ƒ ‚ q q Wd g } | j ru | j d ƒ n | j | j ƒ | j j
d | | j | j | j
ƒ d S( Ni iÿÿÿÿs” You cannot move a source bucket using the mv command. If you meant to move
all objects in the bucket, you can use a command like:
gsutil mv %s/* %ss -Ms -Rt cp( t argst suri_buildert
StorageUrit names_bucketR
t recursion_requestedt appendt extendt
unparsed_argst command_runnert RunNamedCommandt headerst debugt parallel_operations( t selft arg_to_checkR ( ( s/ /tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/mv.pyt
RunCommand‡ s ( t __name__t
__module__t __doc__R R R R R R t TrueR t FalseR R R t command_specR R R t COMMAND_HELPR R
t _detailed_help_textR t help_specR( ( ( ( s/ /tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/mv.pyR ^ s$
N( t
gslib.commandR R R R R R R R R R t gslib.exceptionR
t gslib.help_providerR R R
R R R t
gslib.utilR R0 R ( ( ( s/ /tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/mv.pyt s&