FilesFunctions to work with files and directories |
List content of file or directory |
|
Generate a copy of a file or of a directory |
|
Move a file or a directory to another place |
|
Remove file or directory (ignore call, if it does not exist) |
|
Remove file (ignore call, if it does not exist) |
|
Create directory (if directory already exists, ignore call) |
|
Inquire whether file or directory exists |
|
Trigger an assert, if a file or directory exists |
|
Get full path name of file or directory name |
|
Split path name in directory, file name kernel, file name extension |
|
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) |
|
Return the absolute path name of a URI or local file name |
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/type | Description |
---|---|
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. |