Files.move(oldName, newName); Files.move(oldName, newName, replace = true);
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.
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
impure function move extends Modelica.Icons.Function; input String oldName "Name of file or directory to be moved"; input String newName "New name of the moved file or directory"; input Boolean replace = false "= true, if an existing file or directory may be replaced"; end move;