Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Deleting folder

Deleting folder

Scheduled Pinned Locked Moved ASP.NET
csharpvisual-studiosysadminquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Soumini Ramakrishnan
    wrote on last edited by
    #1

    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?

    S 1 Reply Last reply
    0
    • S Soumini Ramakrishnan

      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?

      S Offline
      S Offline
      Soumini Ramakrishnan
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups