'how to remove folders in azure app service - avoid timeout?

I have a console app running as a webjob. over time , the program has been creating many folders if i say "dir" i get timeout. if i try to delete , i get timeout how to i get rid of the folders?

example : process [9232] terminated! Press ENTER to start a new cmd process.

I tried to delete the files with a batch file (below) but it times out . forfiles /P D:\home\xx\Runs /M * /C "cmd /c if @isdir==FALSE del @file"

forfiles /P D:\home\xx\Runs /M * /C "cmd /c if @isdir==TRUE rmdir /S /Q @file"



Solution 1:[1]

App services have a neat feature available called Kudu console allowing you to browse catalogs and manipulate folders and files.

  1. Go to the app service console and find an "Advanced Tools" option and click on Go.

enter image description here

  1. New tab will open, at the top you will find menu. Click on cmd or powershell to enter shell. I assume you are running Windows App service plan, but the steps are similar for Linux based service plans. enter image description here

  2. Now you can either use UI at the top to delete files/folder or run some commands. enter image description here

In general Kudu is a pretty helpful tool. If you want to learn more about it please check docs here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kamil Konderak