
    u                     |   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  Sr
S	rS
r\R                  \R                  " \R                  R                   5       " S S\R"                  5      5       5       r\R                  \R                  " \R                  R&                  5       " S S\5      5       5       rg)zCImplementation of Unix-like cp command for cloud storage providers.    )absolute_import)division)unicode_literals)base)cp_command_util)flagsa	  
Copy data between your local file system and the cloud, within the cloud,
and between cloud storage providers.

Please Note - By default, the `cp` command does not follow directory symlinks.
You can use the `--preserve-symlinks` flag to follow directory symlinks.
a  
The following command uploads all text files from the local directory to a
bucket:

  $ {command} *.txt gs://my-bucket

The following command downloads all text files from a bucket to your
current directory:

  $ {command} gs://my-bucket/*.txt .

The following command transfers all text files from a bucket to a
different cloud storage provider:

  $ {command} gs://my-bucket/*.txt s3://my-bucket

Use the `--recursive` option to copy an entire directory tree. The
following command uploads the directory tree ``dir'':

  $ {command} --recursive dir gs://my-bucket

Recursive listings are similar to adding `**` to a query, except
`**` matches only cloud objects and will not match prefixes. For
example, the following would not match ``gs://my-bucket/dir/log.txt''

  $ {command} gs://my-bucket/**/dir dir

`**` retrieves a flat list of objects in a single API call. However, `**`
matches folders for non-cloud queries. For example, a folder ``dir''
would be copied in the following.

  $ {command} ~/Downloads/**/dir gs://my-bucket
a+  
The contexts are preserved when copying to Google Cloud Storage. To overwrite
contexts on the destination object, use `--custom-contexts` or
`--custom-contexts-file`. For example:

  $ {command} gs://my-bucket/object     gs://destination-bucket/object     --custom-contexts=key1=value1,key2=value2
c                   8    \ rS rSrSr\\S.r\S 5       r	S r
Srg)CpL   1Upload, download, and copy Cloud Storage objects.DESCRIPTIONEXAMPLESc                     [         R                  " XR                  5       5        [         R                  " U5        [        R
                  " U5        g N)r   add_cp_and_mv_flagsReleaseTrackadd_recursion_flagr   add_per_object_retention_flags)clsparsers     lib/surface/storage/cp.pyArgsCp.ArgsV   s5    ''0@0@0BC&&v.	((0    c                 :    [         R                  " U5      U l        g r   )r   run_cp	exit_code)selfargss     r   RunCp.Run\   s    $++D1DNr   )r   N)__name__
__module____qualname____firstlineno____doc___COMMAND_DESCRIPTION_GA_EXAMPLESdetailed_helpclassmethodr   r!   __static_attributes__ r   r   r
   r
   L   s/     : *-
 1 1
2r   r
   c                   (    \ rS rSrSr\\\-   S.rSr	g)CpAlphaa   r   r   r-   N)
r#   r$   r%   r&   r'   r(   r)   _ALPHA_EXAMPLESr*   r,   r-   r   r   r/   r/   a   s     : *0-r   r/   N)r'   
__future__r   r   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.storager   r   r(   r)   r1   UniverseCompatibleReleaseTracksr   GACommandr
   ALPHAr/   r-   r   r   <module>r:      s    J &  ' ( > 4  B D%%(()2 2 * 2& D%%++,b  - r   