Deleteing a folder within a folder

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

I need a script that will delete folders within a folder.
Not files withing a folder.
 
This should do the trick..

'***********
Dim oFSO
Dim oFolder
Dim sFolder
Dim item

sFolder="c:\MyRootFolder"
Set oFSO=CreateObject("scripting.filesystemobject")
Set oFolder=oFSO.GetFolder(sFolder)

For Each item In oFolder.SubFolders
item.delete
next
'***********

Regards

Niclas Lindblom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top