Help Center
Help CenterFreeBASIC

MkDirfunction

Makes a folder/directory on the local file system

Operating System Functionsfunctiondocumented

Syntax

Declare Function MkDir ( ByRef folder As Const String ) As Long

Parameters

NameDescription
folderThe new default folder/directory to be created, or a path to the sub-folder/sub-directory to be created.

Return value


Returns zero (0) on success, and negative one (-1) on failure.

Description


Creates a folder/directoy on the local file system.

If folder is not a simple folder/directory name, but a path to a sub-folder/sub-directory, the parent folder(s)/directory(s) specified in the path must already exist.
(only one folder/directory can be created for each request)

Remarks

Usage


result = MkDir( folder )

Platform Differences


  • Linux requires the filename case matches the real name of the file. Windows and DOS are case insensitive.
  • Path separators in Linux are forward slashes / . Windows uses backward slashes \ but it allows for forward slashes . DOS uses backward \ slashes.

Differences from QB


  • None

See also


Example


Dim pathname As String = "foo\bar\baz"

Dim result As Long = MkDir( pathname )



If 0 <> result Then Print "error: unable to create folder " & pathname & " in the current path."

Reference

  • Documented in KeyPgMkdir.html