Use Kudu /api/command interface in Azure deployments to AppServices to delete files starting with „.????“

Deploying a new artifact to Azure AppServices via ZIP-Deployment generates files starting with „.????“ even if the service is stopped. It seems that there is still running something and that the deletion step in the ZIP-Deployment process produces this behavior. With this files in a directory, Kudu does not display the files of the directory in the top view but you can use PowerShell to see them and to delete them.

Hint: Integrate deleting into your deployment process, preferably before the deployment to delete old files if the last deployment was not good and after the deployment.

You can use the POST /api/command endpoint of the Kudu Interface from the AppServices, providing a wildcard delete statement. Examples:

Delete everything:

$CommandBody = @{

command = „rm -d -r *“

dir = „site\\wwwroot“

}

Delete file beginning with „.????“:

$CommandBody = @{

command = „del .????*“

dir = „site\\wwwroot“

}

An example of the URL to call with the PowerShell command Invoke-RestMethod -Method Post is:

http://<AppServiceName&gt;.scm.azurewebsites.net/APi/command

More informations about Kudu and the api’s you can find here: Kudu @ GitHub.

A Sample for using the Kudu REST API Interface you can find here: DOS command with Kudu

Samples for using the VFS (Kudus Virtual File System api) you can find here: Kudu VFS