CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 1999
    Location
    Holland
    Posts
    34

    Deleting whole durectories...

    Hi,

    my app creates a directory and puts some subdirectories in it with some files. When the app exits I want to delete all the directories.
    I looked at the kill and rmdir command, but kill can only be used on files and rmdir doesn't do subdirectories.
    Anybody got any ideas?
    Thanks


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Deleting whole durectories...

    use the FileSystemobject

    Dim fso
    set fso = CreateObject("Scripting.FileSystemObject")
    Dim filespec as string
    filespec = "c:\schrott\test"
    fso.DeleteFolder filespec, true





  3. #3
    Join Date
    May 1999
    Posts
    3,332

    Re: Deleting whole durectories...

    small improvement:

    Dim fso as Scripting.FileSystemObject
    set fso = new Scripting.FileSystemObject
    Dim filespec as string
    filespec = "c:\schrott\test"
    fso.DeleteFolder filespec, true



    use early binding: add a reference to "microsoft scripting runtime" to your vb project.
    and yes, it does delete subfolders.



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