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/DebugConsole
OR
Navigate to your deployed App =>
Advanced Tools
=>Go
Debug console
=>cmd
=>site
=>wwwroot
, you will find all the deployed files/folders. Option toedit/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.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.App service
=>Web Jobs
=>Create a Web Job
.WebJob
and click on run to test the script.WebJob Status
under Logs.