We want to copy or delete the files from the root folder of Azure app service(web app).
We have multiple web application hosted in azure, we need to copy/download and delete the files from the root folder of all the web application using another web application.
Note: we are creating new web app which will access the other web application's root folder and copy/delete the files.
d:\\home\site\wwwroot\LogFiles
For the Azure Windows App Service:
Azure Windows App Service, you will find an option to delete the files in KUDU Console. Path to KUDU -https://YourAppName.scm.azurewebsites.net/DebugConsoleOR
Navigate to your deployed App =>
Advanced Tools=>GoDebug console=>cmd=>site=>wwwroot, you will find all the deployed files/folders. Option toedit/delete/downloadcan 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=>wwwrootfolder.with
ls, you can see the existing files and folders.run the below command to delete a single file.
rm filenameEx:
rm appsettings.jsonTo delete folder/directory, use the below command.
rm -r FolderNameUpdate:
Thanks @Niels Swimberghe for the
PowerShellScript.Create a PowerShell script with the
LogFilespath and save as.ps1extension.App service=>Web Jobs=>Create a Web Job.WebJoband click on run to test the script.WebJob Statusunder Logs.