WOLFRAM SYSTEM MODELER

Files

Functions to work with files and directories

Package Contents

list

List content of file or directory

copy

Generate a copy of a file or of a directory

move

Move a file or a directory to another place

remove

Remove file or directory (ignore call, if it does not exist)

removeFile

Remove file (ignore call, if it does not exist)

createDirectory

Create directory (if directory already exists, ignore call)

exist

Inquire whether file or directory exists

assertNew

Trigger an assert, if a file or directory exists

fullPathName

Get full path name of file or directory name

splitPathName

Split path name in directory, file name kernel, file name extension

temporaryFileName

Return arbitrary name of a file that does not exist and is in a directory where access rights allow to write to this file (useful for temporary output of files)

loadResource

Return the absolute path name of a URI or local file name

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

This package contains functions to work with files and directories. As a general convention of this package, '/' is used as directory separator both for input and output arguments of all functions. For example:

exist("Modelica/Mechanics/Rotational.mo");

The functions provide the mapping to the directory separator of the underlying operating system. Note, that on Windows system the usage of '\' as directory separator would be inconvenient, because this character is also the escape character in Modelica and C Strings.

In the table below an example call to every function is given:

Function/typeDescription
list(name) List content of file or of directory.
copy(oldName, newName)
copy(oldName, newName, replace=false)
Generate a copy of a file or of a directory.
move(oldName, newName)
move(oldName, newName, replace=false)
Move a file or a directory to another place.
remove(name) Remove file or directory (ignore call, if it does not exist).
removeFile(name) Remove file (ignore call, if it does not exist)
createDirectory(name) Create directory (if directory already exists, ignore call).
result = exist(name) Inquire whether file or directory exists.
assertNew(name,message) Trigger an assert, if a file or directory exists.
fullName = fullPathName(name) Get full path name of file or directory name.
(directory, name, extension) = splitPathName(name) Split path name in directory, file name kernel, file name extension.
fileName = temporaryFileName() Return arbitrary name of a file that does not exist
and is in a directory where access rights allow to
write to this file (useful for temporary output of files).
fileReference = loadResource(uri) Return the absolute path name of a URI or local file name.

Wolfram Language

In[1]:=
SystemModel["Modelica.Utilities.Files"]
Out[1]:=