copy

Function

ArgDescriptionType
filenameThe file to copy from.OSPath (required)
accessorThe accessor to usestring
destThe destination file to write.string (required)
permissionsPermissions for the destination file (e.g. rw-rw-rwx or 0755).string
dir_permissionsPermissions for intermediate directories.string
appendIf true we append to the target file otherwise truncate itbool
create_directoriesIf true we ensure the destination directories existbool

Required permissions:FILESYSTEM_WRITE FILESYSTEM_READ

Description

Copy a file.

The source file can use any accessor - for example one can copy the $MFT using the ntfs accessor to a regular file. Another example is to extract a file from a zip file using the zip accessor into a file on disk.

This function can also be used to create new files with prescribed content, for example:

SELECT copy(filename="Hello world", accessor="data", dest="C:/hi.txt")
FROM scope()

NOTE: Sparse files are padded out