| Server IP : 35.236.43.222 / Your IP : 216.73.216.143 Web Server : Apache System : Linux order-form-vm-001 5.10.0-37-cloud-amd64 #1 SMP Debian 5.10.247-1 (2025-12-11) x86_64 User : deploy ( 1002) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/google-cloud-sdk/lib/surface/storage/__pycache__/ |
Upload File : |
�
��� � � � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddlm
Z
dd lmZ ej G d
� dej
� � � � ZdS )
zCImplementation of Unix-like mv command for cloud storage providers.� )�absolute_import)�division)�unicode_literals)�base)�cp_command_util)�errors)�flags)�storage_urlc �8 � e Zd ZdZddd�Zed� � � Zd� ZdS )�MvzMoves or renames objects.aL
The 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.
*Renaming Groups Of Objects*
You can use the mv command to rename all objects with a given prefix to
have a new prefix. For example, the following command renames all objects
under gs://my_bucket/oldprefix to be under gs://my_bucket/newprefix,
otherwise preserving the naming structure:
$ {command} gs://my_bucket/oldprefix gs://my_bucket/newprefix
Note that when using mv to rename groups of objects with a common prefix,
you cannot specify the source URL using wildcards; you must spell out the
complete name.
If you do a rename as specified above and you want to preserve ACLs.
*Non-Atomic Operation*
Unlike the case with many file systems, the 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, Coldline Storage, or Archive
Storage object, deletion and data retrieval charges apply.
See the documentation for pricing details.
a�
To move all objects from a bucket to a local directory you could use:
$ {command} gs://my_bucket/* dir
Similarly, to move all objects from a local directory to a bucket you
could use:
$ {command} ./dir gs://my_bucket
The following command renames all objects under gs://my_bucket/oldprefix
to be under gs://my_bucket/newprefix, otherwise preserving the naming
structure:
$ {command} gs://my_bucket/oldprefix gs://my_bucket/newprefix
)�DESCRIPTION�EXAMPLESc �V � t j |� � t j |� � d S )N)r �add_cp_and_mv_flagsr �add_per_object_retention_flags)�cls�parsers �lib/surface/storage/mv.py�ArgszMv.ArgsS s* � ��'��/�/�/� �(��0�0�0�0�0� c �h � t j |� � |j D ]s}t j |� � }t |t j � � r(|� � � st j d� � �|j
rt j d� � ��td|_ t j
|d�� � | _ d S )NzCannot mv buckets.zCannot mv stdin.T)�
delete_source)r �RequireProjectID�sourcer
�storage_url_from_string�
isinstance�CloudUrl� is_objectr �InvalidUrlError�is_stdio� recursiver �run_cp� exit_code)�self�args�
url_string�urls r �RunzMv.RunX s� � ���$�����k� 9� 9�
��/�
�;�;�c� �C��-� .� .� ;�s�}�}��� ;��$�%9�:�:�:� �� 9��$�%7�8�8�8�9� �D�N�$�+�D��E�E�E�D�N�N�Nr N)�__name__�
__module__�__qualname__�__doc__�
detailed_help�classmethodr r( � r r r r sa � � � � � �!�!�
�>
�A1� 1�-�f �1� 1� �;�1�F� F� F� F� Fr r N)r, �
__future__r r r �googlecloudsdk.callioper �"googlecloudsdk.command_lib.storager r r r
�UniverseCompatible�Commandr r/ r r �<module>r5 s� �� J� I� &� &� &� &� &� &� � � � � � � '� '� '� '� '� '� (� (� (� (� (� (� >� >� >� >� >� >� 5� 5� 5� 5� 5� 5� 4� 4� 4� 4� 4� 4� :� :� :� :� :� :� ��FF� FF� FF� FF� FF��� FF� FF� ��FF� FF� FFr