This function copy a file from a source location to a file at the destination. This function copies the contents of the source file, so that source and destination have the same content. Since the transactions happen through kernel-calls, this function is faster than performing the copying yourself.
bool translator.copy ( string srcPath, string dstPath )
- srcPath: a path to the source file
- dstPath: the path to the new file that should be copied into
This function returns true if the file pointed at by srcPath is an accessible file that can be read from and the requested file a dstPath could be created and written to, false otherwise.
This snippet backups a copy of client-side configuration for safety purposes.
-- Create a generic translator. local resRoot = fileCreateTranslator( "/" ); resRoot.copy( "config.xml", "backup/config.xml" );