Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 12.2   12.3   12.4   12.5   13.0   13.1   13.2   13.3   13.4   13.5    Statistic    FMM    Blog  

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

💬 Ask a question or report a problem