move

Move a file or a directory to another place

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

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

Syntax

move(oldName, newName, replace)

Inputs (3)

oldName

Type: String

Description: Name of file or directory to be moved

newName

Type: String

Description: New name of the moved file or directory

replace

Default Value: false

Type: Boolean

Description: = true, if an existing file or directory may be replaced