Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure: 409 Conflict: Cannot delete directory. It is either not empty or access is not allowed

I use Azure with node js App Service. When i try to delete empty folder using ftp or kudu app in node_modules folders i get error: 409 Conflict: Cannot delete directory. It is either not empty or access is not allowed. This folder is totally empty. How i can delete it?

like image 512
DarDev Avatar asked Sep 22 '17 10:09

DarDev


4 Answers

All Azure Web Apps (as well as Mobile App/Services, WebJobs and Functions) run in a secure environment called a sandbox. Each app runs inside its own sandbox, isolating its execution from other instances on the same machine as well as providing an additional degree of security and privacy which would otherwise not be available. For more details, refer to this article.

For directory level access please refer the below:

Home directory access (d:\home):

Every Azure Web App has a home directory stored/backed by Azure Storage. This network share is where applications store their content. This directory is available for the sandbox with read/write access.

The sandbox implements a dynamic symbolic link in kernel mode which maps d:\home to the customer home directory. This is done to remove the need of the customer to keep referencing their own network share path when accessing the site. No matter where the site runs, or how many sites run on a VM, each can access their home directory using d:\home.

Local directory access (d:\local):

This is a temporary directory and can be deleted when no longer needed. This directory is a place to store temporary data for the application. The application naturally has read/write access to this directory.

Note that the d:\local folder in the scm site (where Kudu runs) is not the same as the one in the main site (where the web app runs). As a result, they cannot see each other's local files.

Incase if you haven’t tried this already, use the rmdir directoryname /s /q command in Kudu Console to delete the directory and see if that works.

You can also run this command from Web App console. To access, Goto Web app -> Development Tools -> Console

enter image description here

Hope this helps.

like image 110
AshokPeddakotla-MSFT Avatar answered Nov 14 '22 03:11

AshokPeddakotla-MSFT


Check AppSettings of Web App and delete the setting ‘WEBSITE_RUN_FROM_PACKAGE’ or changing the setting value to 0.

0 - write mode; 1 - read-only mode

like image 32
sajid irfan Avatar answered Nov 14 '22 02:11

sajid irfan


There is a Process explorer tab in the header.

  1. Open Process explorer
  2. Kill the task that's using the folder or file
  3. You will be able to delete the folder in question

This is how I resolved the same issue.

like image 3
Drozdovas Avatar answered Nov 14 '22 03:11

Drozdovas


Here is my solution: adding this option to your step deploying to the app service. Hope it would help

Options for deploying

like image 2
Nguyễn Vũ Đức Anh Avatar answered Nov 14 '22 02:11

Nguyễn Vũ Đức Anh