Search code examples
vb.netinstallationdirectory

How do I create a folder in VB if it doesn't exist?


I wrote myself a little downloading application so that I could easily grab a set of files from my server and put them all onto a new pc with a clean install of Windows, without actually going on the net. Unfortunately I'm having problems creating the folder I want to put them in and am unsure how to go about it.

I want my program to download the apps to program files\any name here\

So basically I need a function that checks if a folder exists, and if it doesn't it creates it.


Solution

  • If Not System.IO.Directory.Exists(YourPath) Then
        System.IO.Directory.CreateDirectory(YourPath)
    End If