Skip to content

Tasks | Cp

Oleg edited this page Apr 8, 2017 · 6 revisions

Copy (copy files) task

Requires version 0.10.x

Copies individual files, folders and filesets to another location.

Eventually cp alias will be provided.

Copy task accepts settings of the CopyArgs type:

type CopyArgs = {
    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.File
...
do! Copy {CopyArgs.Default with file = "bin/*.exe"; todir = "deploy"}
/// or simplified syntax:
do! copy {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! copy {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! copy {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! copy {
    files (fileset {
        basedir "bin"
        includes "*.exe"
    })
    todir "deploy"
}

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

Clone this wiki locally