# Method Stdio.cp()

Method cp

  ``int` cp(`string` `from`, `string` `to`)`

Description

  Copies the file `from` to the new position `to`. If there is no system function for cp, a new file will be created and the old one copied manually in chunks of DATA_CHUNK_SIZE bytes.

  This function can also copy directories recursively.

Returns

  0 on error, 1 on success

Note

  This function keeps file and directory mode bits, unlike in Pike 7.6 and earlier.