azureazure-cli

how to clean specific folder when deploying to that folder with 'az webapp deploy'


I am trying to deploy a zip file to a specific folder within a webapp, but I want to make sure that folder is empty.

this is my command:

az webapp deploy 
   --resource-group $(ResourceGroup) 
   --name $(AppName) 
   --src-path $zip_artifact 
   --type zip 
   --target-path Document_Path
   --clean false

If I use Clean True, it clean entire root of the app (including outside of Document_Path)

Is there another way to clean just a folder?


Solution

  • As I have already mentioned, Clean flag is implemented to clean the root directory of the web app only but not the specific directories.

    Instead of using az webapp deploy you can use curl command to invoke the web app as detailed below.

    webapp="apsbjah"
    Resourceg="Jahnavi"
    User="$apsbjah"
    Password="oSxxxxxZkrvHM"
    path="site/wwwroot/A"
    curl -u $User:$Password -X DELETE "https://$webapp.scm.azurewebsites.net/api/vfs/$path"
    

    Output:

    enter image description here