+ Post New Thread
Results 1 to 2 of 2
Scripts Thread, vb script to delete sub folders in Coding and Web Development; hi guys does any one have any vb code that will the the folder contents of a folder on a ...
  1. #1
    ful56_uk's Avatar
    Join Date
    Mar 2008
    Location
    Essex
    Posts
    569
    Thank Post
    108
    Thanked 25 Times in 22 Posts
    Rep Power
    19

    vb script to delete sub folders

    hi guys

    does any one have any vb code that will the the folder contents of a folder on a local machine but leave the root folder in place

    mark

  2. #2
    box_l's Avatar
    Join Date
    May 2007
    Location
    Herefordshire
    Posts
    436
    Thank Post
    77
    Thanked 94 Times in 78 Posts
    Rep Power
    63
    deletes folders and files too

    Code:
    Dim fso, fldr
    Set fso = CreateObject("Scripting.FilesystemObject")
     
    Set fldr = fso.GetFolder("c:\test_area")
     
    'delete subfolders
    For Each subf In fldr.SubFolders
    
    subf.Delete True
    
    Next
    
    'delete subfiles
    For Each fsofile In fldr.Files
    
    fsofile.Delete True
    
    Next
    edit: be careful where you run this, it deletes everthing below!
    Last edited by box_l; 30th April 2010 at 11:02 PM.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 4
    Last Post: 20th March 2009, 10:15 AM
  2. Replies: 6
    Last Post: 26th September 2008, 03:57 PM
  3. Script to delete specific folders
    By Baasha_Bhai in forum Scripts
    Replies: 8
    Last Post: 2nd July 2008, 10:41 AM
  4. VB script to delete certain folders
    By PTD in forum Scripts
    Replies: 7
    Last Post: 4th June 2008, 12:30 PM
  5. Script to delete certain folders
    By Pumaedition in forum Scripts
    Replies: 4
    Last Post: 22nd April 2008, 10:08 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •