Goto main content

copy

Use to copy file.

COPY

NAME

copy - Use to copy file.

SYNOPSIS

copy([append:true|false,create:true|false,error:variabl]"src filename", "dst filename");
copy([append:true|false,create:true|false,error:variabl]src:"src filename", dst:"dst filename");

DESCRIPTION

This function is used to copy a source file to a destination file.

If Append is true and destination exist, it will append to the file.

If create is false and destination file does not exist, the file won't be created.

File are copied from the root of the file system.

The root of the filesystem is defined in the configuration file. See ExtensoConfig for more information.

EXAMPLES

res=<{ copy("a", "b"); }>. return .*open src.*));
res=<{ copy(create:false, "c1", "b"); }>. return .*stat dst .*
res=<{ copy(append:false, "/tests/c1", "/tests/c2"); size("/tests/c1") == size("/tests/c2"); }>. return res=true.
res=<{ copy(src:"/tests/c1", "/tests/c2"); 2*size("/tests/c1") == size("/tests/c2");}>. return res=true.
res=<{ copy(src:"/tests/c1", dst:"/tests/c2"); 3*size("/tests/c1") == size("/tests/c2");}>. return res=true.
res=<{ copy(append:false,src:"/tests/c1", dst:"/tests/c2"); size("/tests/c1") == size("/tests/c2");}>. return res=true.
res=<{ copy(create:false,src:"/tests/c1", dst:"/tests/c3"); size("/tests/c1") == size("/tests/c2");}>. return .*stat dst.*

SEE ALSO

{{ include("includes/files.sn") }}

AUTHOR

Written by Pierre Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.