copyFile package:Cabal
Given a relative path to a file, copy it to the given directory,
preserving the relative path and creating the parent directories if
needed.
Given a relative path to a file, copy it to the given directory,
preserving the relative path and creating the parent directories if
needed.
Copies a file without copying file permissions. The target file is
created with default permissions. Any existing target file is
replaced.
At higher verbosity levels it logs an info message.
Copies a bunch of files to a target directory, preserving the
directory structure in the target location. The target directories are
created if they do not exist.
The files are identified by a pair of base directory and a path
relative to that base. It is only the relative part that is preserved
in the destination.
For example:
copyFiles normal "dist/src"
[("", "src/Foo.hs"), ("dist/build/", "src/Bar.hs")]
This would copy "src/Foo.hs" to "dist/src/src/Foo.hs" and copy
"dist/build/src/Bar.hs" to "dist/src/src/Bar.hs".
This operation is not atomic. Any IO failure during the copy
(including any missing source files) leaves the target in an unknown
state so it is best to use it with a freshly created directory so that
it can be simply deleted if anything goes wrong.