Deleting objects permanently using gsutil

Just as you would use the rm command to delete a file on your own system, the gsutil rm command can be used to remove files and directories within a bucket:

  1. Use the gsutil rm command as follows to delete file(s) from the bucket. The command is followed by the source URL of the file and an optional -r to indicate removal of internal subdirectories along with files in a folder:
gsutil rm gs://loonycorn-bucket-00/image1.png
  1. Do not forget to add a file extension properly or the file shall not be deleted. Later, you can use the ls command to verify your deletion.
  2. Similarly, the rb command deletes the whole bucket, along with the files inside it.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset