1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to empty a folder?

Discussion in 'C#' started by bclassic, May 17, 2008.

  1. #1
    A-folder has several folders under.
    I want delete those folders all under the A-folder.
    I want to keep the A-folder alive but shall be an empty folder.
    How to do it?
    SEMrush
    I use fso.DeleteFolder(Path) but this way kills A-folder.
     
    bclassic, May 17, 2008 IP
    SEMrush
  2. thewebhostingdir

    thewebhostingdir Well-Known Member

    Messages:
    3,850
    Likes Received:
    84
    Best Answers:
    0
    Trophy Points:
    165
    #2
    Fasted way is to fire fso.CreateFolder(path) just after fso.DeleteFolder(path).
     
    thewebhostingdir, May 17, 2008 IP
  3. bclassic

    bclassic Peon

    Messages:
    206
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    But by this way you have to goto CP and setup the folder permission again.
    I donot want to go to CP to setup permission again.
    Any other way?
     
    bclassic, May 17, 2008 IP
  4. nubsii

    nubsii Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can iterate through the contents of the folder-A and delete everything. This post is a few days old, if you are still looking for a solution I have some code that does something very similar (the opposite, expands a folder structure outwards like a tree), I'll find it if you still need it.

    Also do you only want to delete the folders under folder-A? or also any files that are in the root of folder-A as well?
     
    nubsii, May 22, 2008 IP
  5. bclassic

    bclassic Peon

    Messages:
    206
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Someone sent PM to me.
    Problem solved
     
    bclassic, Jun 8, 2008 IP