CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    simple deltree question

    i hope someone can help me out here,
    i wrote this in an old batch file,
    deltree/y c:\windows\tempor~1
    how can i write that same thing in vb?
    Thanks,
    Ele


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: simple deltree question

    You have a couple of options:

    You could run the same batch file via the Shell Command, eg.
    Shell "BatchFile.bat"

    You could use the Kill and RmDir Functions to Systematically Remove the Directory Structure.

    Perhaps the easiest to implement would be to use the FileSystemObject from the Scripting Runtime Library, eg.

    private Sub Command1_Click()
    Dim oFSO as Object
    set oFSO = CreateObject("Scripting.FileSystemObject")
    oFSO.DeleteFolder "Directory Path Here"
    set oFSO = nothing
    End Sub




    This Method will Remove the Specified Directory and any Files or Sub Directories there in.

    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured