directory create ...

Prev Next

Function Names

directory create, directory create all, directory create silently

Description

These functions create specified directories (including their files) and come in following flavors:
directory create will assert an exception if the directory cannot be created (e.g. directory already existing, access restrictions, etc.) Execution will stop immediately.
directory create silently will create the directories until a first failure is encountered. In this case, the applicable one of the short error messages on directories and files will be returned. If no errors have been encountered, "OK" will be returned. directory create all tries to create all directories and skips the ones which cannot be created. Here, the number of successfully created directories will be returned.

Call as: procedure or function

Restrictions

Indirect parameter passing is enabled.
Wildcards are not supported here

Parameter count

Min 0

Parameters

No.TypeDescription
1, etc.
input
parameter set or string direcory name(s)

Specify the directory name(s). If the directory shall be created in a location other than the working directory, then specify the full path. Intermediate sub-directories between existing directories and the location of the new directory will be created automatically, too, so you don't need to call this function for "dir1"; "dir1/dir2", "dir1/dir2/dir3" ... etc.

Return value

TypeDescription
numeral or string Feedback

directory create: Always "OK", because all errors cause exceptions.
directory create silently: "OK", or short error messages on directories and files.
directory create all: Number of successful operations (directories created) is returned.

Exceptions

Directory is already existing
invalid path name

Examples

      directory create( { My Folder 1 .. My Folder 5 } ); // Create 5 directories

      if (system info[operating system]=Windows)
          system( 'dir /W "My Folder*"' ); // Show directory listing
      else:
          system( "ls 'My Folder'* " ); // Show directory listing

          directory delete recursive( "", "My Folder *" ); // Delete "My Folder 1" and "... 2".

Output

 Datenträger in Laufwerk C: ist Windows
Volumeseriennummer: 96E3-BA76

Verzeichnis von C:\Users\zur-b\OneDrive\Documents\Programme\Beyond4P\B4P_Docu_Maker

[My Folder 1] [My Folder 2] [My Folder 3] [My Folder 4] [My Folder 5]
               0 Datei(en),              0 Bytes
               5 Verzeichnis(se), 76’149’633’024 Bytes frei
Try it yourself: Open LIB_Function_directory_create.b4p in B4P_Examples.zip. Decompress before use.

See also

directory create temp
directory delete ... Functions
mkdir
md