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. General Programming
  3. Visual Basic
  4. Remove a Directory and its contents.

Remove a Directory and its contents.

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestion
3 Posts 2 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.
  • B Offline
    B Offline
    Brad Fackrell
    wrote on last edited by
    #1

    I’m currently using IO.Directory.Delete(folderToDelete) to remove a folder. The problem is that it will not delete a folder that contains other folders and/or files. Does anybody now how to remove a folder even if it has sub folders and/or files? Could I use IO.Directory.Move(folderPathToDelete,"") or is that 'bad practice'? Thank Brad

    P 1 Reply Last reply
    0
    • B Brad Fackrell

      I’m currently using IO.Directory.Delete(folderToDelete) to remove a folder. The problem is that it will not delete a folder that contains other folders and/or files. Does anybody now how to remove a folder even if it has sub folders and/or files? Could I use IO.Directory.Move(folderPathToDelete,"") or is that 'bad practice'? Thank Brad

      P Offline
      P Offline
      progload
      wrote on last edited by
      #2

      MSDN: Deletes the specified directory and, if indicated, any subdirectories in the directory. [Visual Basic] Overloads Public Shared Sub Delete(String, Boolean) Directory.Delete(folderToDelete, True) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiodirectoryclassdeletetopic.asp[^]

      B 1 Reply Last reply
      0
      • P progload

        MSDN: Deletes the specified directory and, if indicated, any subdirectories in the directory. [Visual Basic] Overloads Public Shared Sub Delete(String, Boolean) Directory.Delete(folderToDelete, True) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiodirectoryclassdeletetopic.asp[^]

        B Offline
        B Offline
        Brad Fackrell
        wrote on last edited by
        #3

        Thanks.

        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