copy

Function

ArgDescriptionType
filenameThe file to copy from.OSPath (required)
accessorThe accessor to usestring
destThe destination file to write.string (required)
permissionsRequired permissions (e.g. ‘x’).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