Files.copy(oldName, newName); Files.copy(oldName, newName, replace = true);
Function copy(..) copies 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 by the required copy.
If oldName/newName are directories, then the newName directory may exist. In such a case the content of oldName is copied into directory newName. If replace = false it is required that the existing files in newName are different from the existing files in oldName.
copy("C:/test1/directory1", "C:/test2/directory2"); -> the content of directory1 is copied into directory2 if "C:/test2/directory2" does not exist, it is newly created. If "replace=true", files in directory2 may be overwritten by their copy copy("test1.txt", "test2.txt") -> make a copy of file "test1.txt" with the name "test2.txt" in the current directory
impure function copy extends Modelica.Icons.Function; input String oldName "Name of file or directory to be copied"; input String newName "Name of copy of the file or of the directory"; input Boolean replace = false "= true, if an existing file may be replaced by the required copy"; end copy;