HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //lib/google-cloud-sdk/lib/surface/storage/__pycache__/copy.cpython-312.pyc
�

���	�N�dZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZejejejj �ej"ej$d
d��Gd
�dej&�����Zy)z&Command to list Cloud Storage objects.�)�absolute_import)�division)�unicode_literals)�base)�copying)�paths)�storage_parallel)�logFzBThis command is deprecated. Use `gcloud alpha storage cp` instead.)�
is_removed�warningc�0�eZdZdZddd�Zed��Zd�Zy)�Copyz1Upload, download, and copy Cloud Storage objects.z}      Copy files between your local file system and Cloud Storage or from one
      Cloud Storage location to another.
      a�
      Uploading files:

        To upload a single file to a remote location:

          $ *{command}* path/to/file.txt gs://mybucket/file.txt
          $ *{command}* path/to/file.txt gs://mybucket/

        The above two commands both create gs://mybucket/file.txt.

        To upload multiple files to a remote location:

          $ *{command}* path/to/a.txt other/path/b.txt gs://mybucket/remote-dir/

        The above command will create gs://mybucket/remote-dir/a.txt and
        gs://mybucket/remote-dir/b.txt. If remote-dir does not exist, this command will create
        remote-dir.

        To upload a directory my-dir and all its sub-directories and files:

          $ *{command}* --recursive my-dir gs://mybucket/remote-dir/

        If my-dir has a subdirectory sub-dir and sub-dir has a file a.txt, the above
        command will create gs://mybucket/remote-dir/my-dir/sub-dir/a.txt. The structure of directory
        is kept.

        The following command also uploads all files in my-dir and sub-directories recursively:

          $ *{command}* my-dir/** gs://mybucket/remote-dir/

        The above command flattens the directory strucutre and creates gs://mybucket/remote-dir/a.txt.

        To upload all files in a directory, ignoring the subdirectories:

          $ *{command}*  my-dir/* gs://mybucket/remote-dir/

        If my-dir has a file a.txt and a subdirectory sub-dir. The above command will ceate
        gs://mybucket/remote-dir/a.txt.

        We can combine the wildcards to upload all text files in a directory and all subdirectories
        recursively:

          $ *{command}*  my-dir/**/*.txt gs://mybucket/remote-dir/

      Downloading files:

        To download a single file:

          $ *{command}* gs://mybucket/file.txt local-dir/
          $ *{command}* gs://mybucket/file.txt local-dir/file.txt

        The above two commands both create local-dir/file.txt.

        To download multiple files:

          $ *{command}* gs://mybucket/a.txt gs://mybucket/b.txt local-dir/

        The above command creates local-dir/a.txt and local-dir/b.txt.

        To download a directory and all its sub-directories and files:

          $ *{command}* --recursive gs://mybucket/remote-dir/ local-dir/

        The above command creates local-dir/remote-dir/ which contains all files and subdirectories
        of gs://mybucket/remote-dir/. The structure of directory is kept.

        The following command also downloads all files in gs://mybucket/remote-dir/ to local-dir:

          $ *{command}* gs://mybucket/remote-dir/** local-dir/

        If remote-dir contains files a.txt and sub-dir/b.txt, the above command flattens the
        directory structure and creates local-dir/a.txt and local-dir/b.txt.

        To download all files, ignoring the subdirectories::

          $ *{command}* gs://mybucket/remote-dir/* local-dir/

        We can combine the wildcards to download all text files under remote-dir and its
        subdirectories:

          $ *{command}* gs://mybucket/remote-dir/**/*.txt local-dir/

      Coping between Cloud Storage locations:

        To copy a single file to another location:

          $ *{command}* gs://mybucket/file.txt gs://otherbucket/file.txt
          $ *{command}* gs://mybucket/file.txt gs://otherbucket/

        The above two commands both create gs://otherbucket/file.txt.

        To copy multiple files to a new location:

          $ *{command}* gs://mybucket/a.txt gs://mybucket/b.txt gs://otherbucket/target-dir/

        The above command creates gs://otherbucket/target-dir/a.txt and
        gs://otherbucket/target-dir/b.txt. If target-dir does not exist, this command will create
        target-dir.

        To copy all files and subdirectories in one location to another:

          $ *{command}* --recursive gs://mybucket/source-dir/ gs://otherbucket/target-dir/

        If source-dir has a subdirectory sub-dir and sub-dir has a file a.txt, the above
        command will create gs://mybucket/target-dir/source-dir/sub-dir/a.txt. The structure of
        directory is kept.

        The following command also copies all files in source-dir and its sub-directories:

          $ *{command}* gs://mybucket/source-dir/** gs://mybucket/target-dir/

        The above command flattens the directory strucutre and creates gs://mybucket/target-dir/a.txt.

        To copy all files in a directory, ignoring the subdirectories:

          $ *{command}* gs://mybucket/source-dir/* gs://mybucket/target-dir/

        If source-dir has a file a.txt and a subdirectory sub-dir. The above command will ceate
        gs://mybucket/target-dir/a.txt.

        We can combine the wildcards to copy all text in one location and all its sub-directories:

          $ *{command}* gs://mybucket/source-dir/**/*.txt gs://mybucket/target-dir/
      )�DESCRIPTION�EXAMPLESc��|jddd��|jdd��|jdd	d
��|jdtd
dd��y)N�source�+zThe source file to copy.)�nargs�help�destinationz$The destination to copy the file to.)rz--recursive�
store_truezPRecursively copy the contents of any directories that match the path expression.)�actionrz
--num-threadsT�z*The number of threads to use for the copy.)�type�hidden�defaultr)�add_argument�int)�parsers �lib/surface/storage/copy.py�Argsz	Copy.Args�s}��
�����
'��)�����
3��5������ ��!�
����
���
9��;�c���|jD�cgc]}tj|���}}tj|j�}t	j
�}|j
|||j��}tj||jd��tjjdjt|�t|�dkDrd��yd��ycc}w)N)�	recursivez
Copying Files)�num_threads�progress_bar_labelzCopied [{}] file{}.
��s�)rr�Pathrr�CopyTaskGenerator�GetCopyTasksr$r	�ExecuteTasksr%r
�status�write�format�len)�self�args�p�sources�dest�copier�taskss       r �RunzCopy.Run�s���&*�k�k�2�k��u�z�z�!�}�k�G�2��:�:�d�&�&�'�D�
�
&�
&�
(�F����������H�E��!�!�
�4�+�+��Q��J�J���,�3�3��E�
�3�u�:��>�C�3�4�/1�3�4��
3s�C2N)�__name__�
__module__�__qualname__�__doc__�
detailed_help�staticmethodr!r9�r"r rrs4��:�
�|
�B�-�H�;��;�(	4r"rN)r=�
__future__rrr�googlecloudsdk.callioper�"googlecloudsdk.command_lib.storagerrr	�googlecloudsdk.corer
�Hidden�
ReleaseTracks�ReleaseTrack�ALPHA�UniverseCompatible�	Deprecate�Commandrr@r"r �<module>rLs��� -�&��'�(�6�4�?�#��������D�%�%�+�+�,��������5�+9�:�e4�4�<�<�e4�:��-�
�
e4r"