Skip to content
Oleg edited this page May 14, 2017 · 5 revisions

Cp (copy files) task

Requires version 0.10.x

Copies individual files, folders and filesets to another location.

there's a copy alias for cp.

Cp task accepts settings of the CpArgs type:

type CpArgs = {
    dir: string
    file: string
    files: Fileset
    todir: string
    flatten: bool
    verbose: bool
    overwrite: bool
    dryrun: bool
}

Command is available via both common and simplified syntax:

open Xake.Tasks
...
do! Cp {CpArgs.Default with file = "bin/*.exe"; todir = "deploy"}
/// or simplified syntax:
do! cp {file "bin/*.exe"; todir "deploy"}

file argument accepts file masks.

Example: copy

The following code will recursively copy the "bin" directory and its content to "deploy" directory preserving the folder structure:

do! cp {dir "bin"; todir "deploy"}

Note: this command will put "bin" under "deploy" like this "deploy/bin/***".

The following command will flatten the file list.

do! cp {dir "bin"; todir "deploy"; flatten}

flatten is explicitly set to true if file is specified.

Using fileset

Using fileset is the most flexible way to define Copy behavior.

do! cp {
    files (fileset {
        basedir "bin"
        includes "*.exe"
    })
    todir "deploy"
}

In this case cp also preserves the directory structure, using basedir as a root of the structure.

Clone this wiki locally