MkDir

Create a directory.

Syntax
      MkDir path

Key
   path   The directory to create.

Any higher-level directories must already exist or MkDir will fail.

UNC paths are not supported, but MkDir will work against mapped drives, alternatively, shell out and run an MD command from the OS:

Dim strPath as String
Const DQ As String =""""
strPath = DQ & "\\Server64\folder1" & DQ
Shell "cmd.exe /c IF NOT EXIST " & strPath & " MD " & strPath, vbNormalFocus

Examples

MkDir "D:\test folder"

'Create only if the folder does not already exist:
If Len(Dir("C:\demo\folder", vbDirectory)) = 0 Then MkDir "C:\demo\folder"

“Is not the whole world a vast house of assignation of which the filing system has been lost?” ~ Quentin Crisp

Related:

Dir - List directory
Windows CMD shell: MKDIR


 
Copyright © SS64.com 1999-2019
Some rights reserved