delete the files from the root folder of Azure app service(web app)
For the Azure Windows App Service:
- If the Web App is deployed to
Azure Windows App Service
, you will find an option to delete the files in KUDU Console.
Path to KUDU - https://YourAppName.scm.azurewebsites.net/DebugConsole
OR
Navigate to your deployed App => Advanced Tools
=> Go

Debug console
=> cmd
=> site
=> wwwroot
, you will find all the deployed files/folders.
Option to edit/delete/download
can be seen.

For the Azure Linux App Service:
Thanks @Dillion Megida for the commands.
In the Azure Linux App Service, navigate to DebugConsole
=>Bash
=> site
=> wwwroot
folder.
with ls
, you can see the existing files and folders.
- Navigate to the folder where you want to delete the files.
run the below command to delete a single file.
rm filename
Ex: rm appsettings.json

To delete folder/directory, use the below command.
rm -r FolderName

Update:
Thanks @Niels Swimberghe for the PowerShell
Script.
Create a PowerShell script with the LogFiles
path and save as .ps1
extension.
$LogFolder = "C:\home\LogFiles";
$DaysToKeepLogsAround = 30;
Get-ChildItem -Path $LogFolder -Recurse ->File | Where LastWriteTime -lt (Get-Date).AddDays(-$DaysToKeepLogsAround) | Remove-Item -Force
- In the Deployed
App service
=> Web Jobs
=> Create a Web Job
.

- Select the
WebJob
and click on run to test the script.
- You can see the files before 30 days got deleted.

- Check the
WebJob Status
under Logs.
