Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Files.ReadAndWriteFile

Reads a file and writes it elsewhere.

Component Version macOS Windows Linux Server iOS SDK
Files 11.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Files.ReadAndWriteFile"; SourcePath; DestPath )   More

Parameters

Parameter Description Example
SourcePath The native path to the file to be copied. "/Users/John/Desktop/test.txt"
DestPath The native path to the target file to write. "/Users/John/Desktop/Backup/"

Result

Returns OK or error.

Description

Reads a file and writes it elsewhere.
The data is read in 10 MB blocks and then written to the destination file.
Usually you may use Files.CopyFile using OS routines, but sometimes clients want a replacement.
Always overwrites files.
Does not copy metadata on purpose.

Examples

Copy a file:

MBS( "Files.ReadAndWriteFile"; "/Users/cs/Desktop/test.dmg"; "/Users/cs/Desktop/test2.dmg" )

See also

Example Databases

Blog Entries

This function is free to use.

Created 16th February 2021, last changed 4th August 2023


Files.MoveToTrash - Files.ReadFile