impure functionmove
Move a file or a directory to another place
Extends from Modelica.Icons.Function (Icon for functions).
Information
Syntax
Files.move(oldName, newName); Files.move(oldName, newName, replace = true);
Description
Function move(..) moves a file or a directory to a new location. Via the optional argument replace it can be defined whether an already existing file may be replaced.
If oldName/newName are directories, then the newName directory may exist. In such a case the content of oldName is moved into directory newName. If replace = false it is required that the existing files in newName are different from the existing files in oldName.
Example
move("C:/test1/directory1", "C:/test2/directory2");
-> the content of directory1 is moved into directory2.
Afterwards directory1 is deleted.
if "C:/test2/directory2" does not exist, it is newly
created. If "replace=true", files in directory2
may be overwritten
move("test1.txt", "test2.txt")
-> rename file "test1.txt" into "test2.txt"
within the current directory
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | oldName | Name of file or directory to be moved | |
| String | newName | New name of the moved file or directory | |
| Boolean | replace | false | = true, if an existing file or directory may be replaced |