Name
MkDir Procedure
Class
Microsoft.VisualBasic.FileSystem
Syntax
MkDir(path)-
path(required; String) The name of the folder to be created
Description
Creates a new folder
Rules at a Glance
If you omit the drive from
path, a new folder will be created on the current drive.You can specify the drive by using either its local drive letter or its UNC name.
pathcan either be a fully qualified path (i.e., a path from the drive’s root directory to the directory to be created) or a relative path (i.e., a path from the current directory).If the directory to be created by the MkDir procedure already exists, an
IOExceptionexception is raised.
Programming Tips and Gotchas
If your program is running on Windows NT, ensure that the logged-in user has the right to create a folder on the specified drive prior to calling the MkDir procedure.
VB does not automatically make the new folder the current folder after a call to MkDir. You will need to call the ChDir procedure to do this.
To remove a folder, use the RmDir procedure.
Use CurDir to determine the current drive.
See Also
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access