copyFile -package:pathtype
Copy a file with its permissions. If the destination file already
exists, it is replaced atomically. Neither path may refer to an
existing directory. No exceptions are thrown if the permissions could
not be copied.
Copy a file with its permissions. If the destination file already
exists, it is replaced atomically. Neither path may refer to an
existing directory. No exceptions are thrown if the permissions could
not be copied.
copyFile old new copies the existing file from
old to
new. If the
new file already exists,
it is atomically replaced by the
old file. Neither path may
refer to an existing directory. The permissions of
old are
copied to
new, if possible.
Copy the content and permissions of a file to a new entry in the
filesystem. If a file already exists at the new location, it will be
replaced. Copying a file is not atomic.
This computation throws
IOError on failure. See “Classifying
I/O errors” in the
System.IO.Error documentation for
information on why the failure occured.
Since: 0.1.1
Lifted version of
copyFile with well-typed filepaths.
This will copy any file directly by using a system call
Copy a file with its associated metadata. If the destination file
already exists, it is overwritten. There is no guarantee of atomicity
in the replacement of the destination file. Neither path may refer to
an existing directory. If the source and/or destination are symbolic
links, the copy is performed on the targets of the links.
On Windows, it behaves like the Win32 function
CopyFile, which
copies various kinds of metadata including file attributes and
security resource properties.
On Unix-like systems, permissions, access time, and modification time
are preserved. If possible, the owner and group are also preserved.
Note that the very act of copying can change the access time of the
source file, hence the access times of the two files may differ after
the operation completes.
Truncate the destination file and then copy the contents of the source
file to the destination file. If the destination file already exists,
its attributes shall remain unchanged. Otherwise, its attributes are
reset to the defaults.
Copy a file with its associated metadata. If the destination file
already exists, it is overwritten. There is no guarantee of atomicity
in the replacement of the destination file. Neither path may refer to
an existing directory. If the source and/or destination are symbolic
links, the copy is performed on the targets of the links.
On Windows, it behaves like the Win32 function
CopyFile, which
copies various kinds of metadata including file attributes and
security resource properties.
On Unix-like systems, permissions, access time, and modification time
are preserved. If possible, the owner and group are also preserved.
Note that the very act of copying can change the access time of the
source file, hence the access times of the two files may differ after
the operation completes.
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.