title: How to move (or copy) blobs between containers in Azure Blob Storage using java
body: <p>I have a java application which I use to upload some artifacts to Azure Blob Storage. Now I am trying to move these files from one container to another. Below is a sample code on what I do right now.</p>
  <pre><code>BlobServiceClient blobServiceClient = new BlobServiceClientBuilder().connectionString(CONNECTION_STRING).buildClient();
    BlobContainerClient releaseContainer = blobServiceClient.getBlobContainerClient(RELEASE_CONTAINER);
    BlobContainerClient backupContainer = blobServiceClient.getBlobContainerClient(BACKUP_CONTAINER);
  
    for (BlobItem blobItem : releaseContainer.listBlobs()) {
       BlobClient destBlobClient = backupContainer.getBlobClient(blobItem.getName());
       BlobClient sourceBlobClient = releaseContainer.getBlobClient(blobItem.getName());
       destBlobClient.copyFromUrl(sourceBlobClient.getBlobUrl());
       sourceBlobClient.delete();
    }
  </code></pre>
  <p>Is there a more straight forward way to do this?
  Also if this is the way to do it how can I delete the old file? sourceBlobClient.delete() doesn't work now.</p>