Deleting folder
-
I am using the following code if (System.IO.Directory.Exists(Server .MapPath ("Albums/username" )) { System.IO.Directory.Delete(Server .MapPath ("Albums/username"),true); } to delete the folder named "username" and all of its subfolders. After this , if I take the folder Albums, I can see "username" folder. But when I double click on the folder, " Access is denied" message is coming. If I close visual Studio the folder itself is disappearing. In production server how will it work?
-
I am using the following code if (System.IO.Directory.Exists(Server .MapPath ("Albums/username" )) { System.IO.Directory.Delete(Server .MapPath ("Albums/username"),true); } to delete the folder named "username" and all of its subfolders. After this , if I take the folder Albums, I can see "username" folder. But when I double click on the folder, " Access is denied" message is coming. If I close visual Studio the folder itself is disappearing. In production server how will it work?
I got the answer. If anyone needs the answer here it is!! My project is stored in a drive which uses NTFS File System and the folder to be deleted is inside my project folder. Since now I have opened this project in Visual Studio, that folder is also being used by Visual Studio.In NTFS, You may not be able to delete a file if the file is being used. You may be able to use the Delete command to delete a file, but the file is not actually deleted until the process that has the file open releases the file.