CURRENT PATH:
/
opt
/
gsutil
/
gslib
/
commands
/
__pycache__
/
[ ⬅ KEMBALI ]
|
[ HOME ]
Upload File:
Upload Ke Sini
Dir Baru
File Baru
Editing:
rm.cpython-39.pyc
a +(Wg@ � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm Z dd lm Z dd lmZ ddlm Z ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl%m'Z' ddl(m)Z) ddl*m+Z+ e j,Z-dZ.de. d Z/d!d"� Z0d#d$� Z1d+d%d&�Z2d'd(� Z3G d)d*� d*e �Z4dS ),zCImplementation of Unix-like rm command for cloud storage providers.� )�absolute_import)�print_function)�division)�unicode_literalsN)�BucketNotFoundException)�NotEmptyException)�NotFoundException)�ServiceException)�Command)�DecrementFailureCount)�CommandArgument)�ApiSelector)�CommandException)�NO_URLS_MATCHED_PREFIX)�NO_URLS_MATCHED_TARGET)�NameExpansionIterator)�SeekAheadNameExpansionIterator)�StorageUrlFromString)�MetadataMessage)� constants)�parallelism_framework_util)�GetCloudApiInstance)�Retry)�GcloudStorageFlag)�GcloudStorageMap)� StdinIterator)�PreconditionsFromHeadersz7 gsutil rm [-f] [-r] url... gsutil rm [-f] [-r] -I z <B>SYNOPSIS</B> aU <B>DESCRIPTION</B> NOTE: As part of verifying the existence of objects prior to deletion, ``gsutil rm`` makes ``GET`` requests to Cloud Storage for object metadata. These requests incur `network and operations charges <https://cloud.google.com/storage/pricing>`_. The gsutil rm command removes objects and/or buckets. For example, the following command removes the object ``kitten.png``: gsutil rm gs://bucket/kitten.png Use the -r option to specify recursive object deletion. For example, the following command removes gs://bucket/subdir and all objects and subdirectories under it: gsutil rm -r gs://bucket/subdir When working with versioning-enabled buckets, note that the -r option removes all object versions in the subdirectory. To remove only the live version of each object in the subdirectory, use the `** wildcard <https://cloud.google.com/storage/docs/wildcards>`_. The following command removes all versions of all objects in a bucket, and then deletes the bucket: gsutil rm -r gs://bucket To remove all objects and their versions from a bucket without deleting the bucket, use the ``-a`` option: gsutil rm -a gs://bucket/** If you have a large number of objects to remove, use the ``gsutil -m`` option, which enables multi-threading/multi-processing: gsutil -m rm -r gs://my_bucket/subdir You can pass a list of URLs (one per line) to remove on stdin instead of as command line arguments by using the -I option. This allows you to use gsutil in a pipeline to remove objects identified by a program, such as: some_program | gsutil -m rm -I The contents of stdin can name cloud URLs and wildcards of cloud URLs. Note that ``gsutil rm`` refuses to remove files from the local file system. For example, this fails: gsutil rm *.txt WARNING: Object removal cannot be undone. Cloud Storage is designed to give developers a high amount of flexibility and control over their data, and Google maintains strict controls over the processing and purging of deleted data. If you have concerns that your application software or your users may at some point erroneously delete or replace data, see `Options for controlling data lifecycles <https://cloud.google.com/storage/docs/control-data-lifecycles>`_ for ways to protect your data from accidental data deletion. <B>OPTIONS</B> -f Continues silently (without printing error messages) despite errors when removing multiple objects. If some of the objects could not be removed, gsutil's exit status will be non-zero even if this flag is set. Execution will still halt if an inaccessible bucket is encountered. This option is implicitly set when running "gsutil -m rm ...". -I Causes gsutil to read the list of objects to remove from stdin. This allows you to run a program that generates the list of objects to remove. -R, -r The -R and -r options are synonymous. Causes bucket or bucket subdirectory contents (all objects and subdirectories that it contains) to be removed recursively. If used with a bucket-only URL (like gs://bucket), after deleting objects and subdirectories gsutil deletes the bucket. This option implies the -a option and deletes all object versions. If you only want to delete live object versions, use the `** wildcard <https://cloud.google.com/storage/docs/wildcards>`_ instead of -r. -a Delete all versions of an object. c C sf | j s| j�t|�� t|t�r@| jd7 _| j�t|�� n"t| j|�rTt � n| j d7 _ dS )z9Simple exception handler to allow post-completion status.� N)�continue_on_error�logger�error�str� isinstancer �bucket_not_found_count�_ExceptionMatchesBucketToDelete�bucket_strings_to_deleter �op_failure_count��cls�e� r* � /opt/gsutil/gslib/commands/rm.py�_RemoveExceptionHandler� s r, c C s. t |t�rt|jv st |t�r&t� n|�dS )z3When removing folders, we don't mind if none exist.N)r"