Skip to content

Tasks | Cp

olegz edited this page Mar 16, 2026 · 6 revisions

Cp — copy files

Copies files, directories, and filesets to another location.

copy is an alias for cp.

Copy files by mask

do! cp {file "bin/*.exe"; todir "deploy"}

The file option accepts file masks.

Copy a directory

Recursively copies a directory and its contents, preserving folder structure:

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

This creates deploy/bin/....

Flatten

Copies files without preserving directory structure:

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

flatten is automatically enabled when using file.

Using filesets

The most flexible way to define copy behavior:

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

cp preserves directory structure relative to the fileset's basedir.

Operations

Operation Description
file "mask" Copy files matching the mask
dir "path" Copy a directory recursively
files fileset Copy files from a fileset
todir "path" Target directory
flatten Do not preserve directory structure
verbose Log each copied file
overwrite Overwrite existing files
dryrun Log without copying

Other copy functions

copyFile

Copies a single file to a specific path:

do! copyFile "src/App.config" "bin/App.exe.config"

copyFrom

Copies a file to the current target:

"bin/app.config" ..> copyFrom "src/App.config"

Clone this wiki locally