Copies the contents of a directory to a destination directory

directoryCopy(source, destination [, recurse][, filter]) → returns void

Argument Reference

source string

Absolute pathname of directory from which you copy content.

destination string

Path of the destination directory. If not an absolute path, it is relative to the source directory.

recurse boolean
Default: false

If true, copies the subdirectories, otherwise only the files in the source directory.

filter any

File extension filter applied, for example, *.cfm. Filter to be used to filter the data copied: - A string that uses "*" as a wildcard, for example, "*.cfm" - a UDF (User defined Function) using the following pattern "functioname(String path):boolean", the function is run for every single file, if the function returns true, then the file is will be added to the list otherwise it will be omitted.

createPath boolean
Default: true

Lucee 4.5+ If set to false, expects all parent directories to exist. If set to true, it will generate necessary directories.

Sample code invoking the directoryCopy function

Copy directory from one place to another.


Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub