How to remove all files from Azure File Share?

Viewed 3022

How to remove all files from Azure File Share? There is no possibility of doing it in GUI also Microsoft Azure File Explorer fails due to proxy between me and the web.

Is there any AZ command or a snippet that clears the given fileshare in Azure?

1 Answers

You could use az storage file delete-batch, specify the --pattern with *, then it will delete all the files in the --source, in your case, if you want to delete all files from the file share, just specify --source with share name.

Note:The command just delete the files, except the directorys.

az storage file delete-batch --account-key 'xxxx' --account-name 'joystoragev2' --pattern * --source 'share1' 
Related