0

I ran the below command to delete the csv files inside folder2 but it was deleted folder1 and folder2 as well. please help me what went wrong here?

Note: I have used service principal (SPN) authentication to connect to the storage account

AzCopy rm https://[account].blob.core.windows.net/[container]/folder1/folder2/ --include-pattern="*.csv" --recursive=true

Ex:

AzCopy rm https://[account].blob.core.windows.net/internal/data/folder1/ --include-pattern="*.csv" --recursive=true

Expected result: inside folder1 there are 2 files (abc.csv and xyz.csv) should get deleted and folder structure should remain available.

Venkatesan
  • 3,748
  • 1
  • 3
  • 15
Ravi
  • 11
  • 2
  • _"and folder structure should remain available."_ - are you using ADLv2 or normal blob storage? – Dai Apr 19 '23 at 10:19
  • (Excepting Azure Data Lake-based storage), [Azure Blob storage doesn't have folders/directories](https://stackoverflow.com/questions/2619007/microsoft-azure-how-to-create-sub-directory-in-a-blob-container) - they're just an _illusion_ created by how Azure Blob Storage merely allows blob names to contain forward-slashes. – Dai Apr 19 '23 at 10:20
  • using the egress storage account, users are pushing the data into /data/folder1/abc.csv, /data/folder2/xyz.csv like that and i need to copy the files as first step and remove those files from folder1 & folder2 directories is the next step. so deletion of only files can't be possible? I am worrying everytime when i ran rm command it get's deleted the folders as well that shouldn't happen – Ravi Apr 19 '23 at 10:53
  • _"so deletion of only files can't be possible?"_ - you appear to misunderstand how Azure Blob Storage works: Blob Storage is not a filesystem: **there are no directories/folders**, so it's meaningless to ask about them or presume they exist. All blobs exist in a flat namespace and slashes are just part of the blob-name. – Dai Apr 19 '23 at 11:01

0 Answers0