delete folder within folder

Discussion in 'Scripting' started by jasont, Feb 10, 2004.

  1. jasont

    jasont Guest

    Using VBScript how can i delete a folder within a folder.
    I can delete files within folders but not folders within
    folders.
     
    jasont, Feb 10, 2004
    #1
    1. Advertisements

  2. jasont

    Robert Cohen Guest

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colFolders = objWMIService.ExecQuery _
    ("Select * from Win32_Directory where Name = 'c:\\Scripts'")
    For Each objFolder in colFolders
    errResults = objFolder.Delete
    Wscript.Echo errResults
    Next
     
    Robert Cohen, Feb 10, 2004
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.