copyGenerate a copy of a file or of a directory |
This information is part of the Modelica Standard Library maintained by the Modelica Association.
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
oldName |
Type: String Description: Name of file or directory to be copied |
---|---|
newName |
Type: String Description: Name of copy of the file or of the directory |
replace |
Default Value: false Type: Boolean Description: = true, if an existing file may be replaced by the required copy |