I have tested in my environment.
Without listing the blobs in a directory, we cannot copy all the blob files in a directory of a storage account to another storage account.
We can copy the blobs in a directory from one storage account to another storage account using below python code:
from azure.storage.blob import BlobServiceClient, BlobClient
source_connect_str = "source_storage_account_connection_string"
destination_connect_str="destination_storage_account_connection_string"
source_blob_service_client = BlobServiceClient.from_connection_string(source_connect_str)
destination_blob_service_client = BlobServiceClient.from_connection_string(destination_connect_str)
source_container_client = source_blob_service_client.get_container_client("containerName")
my_blobs = source_container_client.list_blobs(name_starts_with="directory/")
for my_blob in my_blobs:
source_blob = BlobClient(source_blob_service_client.url,container_name="containerName",blob_name=my_blob.name,credential="sas-token-of-source-storage-account")
destination_blob = destination_blob_service_client.get_blob_client("containerName",my_blob.name)
destination_blob.start_copy_from_url(source_blob.url)
Is there any azure cloud service that performs the copy activity on
some trigger (API call back)?
You can use Azure Logic App in this case to perform the copy activity on a trigger