Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Files.MoveFile
Moves a file or folder without user interface.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Files | 2.8 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "Files.MoveFile"; SourcePath; DestPath { ; Overwrite; SkipSourcePermissionErrors; ProgressTitle } ) More
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
SourcePath | The native path to the file or folder to be moved. | "/Users/John/Desktop/test.txt" | |
DestPath | The native path to the destination folder or file. | "/Users/John/Desktop/Backup/" | |
Overwrite | Mac only: Whether to allow overwriting existing files. Default is off. Pass 1 to enable and 0 to disable. On Windows, it overwrites always. |
1 | Optional |
SkipSourcePermissionErrors | Mac only: Whether to skip files with permission errors. Default is off. Pass 1 to enable and 0 to disable. |
1 | Optional |
ProgressTitle | Title for the progress window. For Windows only and the text may not be visible in your version of Windows. |
"Copying FileMake files" | Optional |
Result
Returns OK or error message.
Description
Moves a file or folder without user interface.SourcePath and DestPath must be valid and exist. So pass destination folder for the destination.
The Linux implementation does only move files within the same file system.
On Mac you may get error -43 for file not found if you refer to a file in a folder, where you don't have file permissions to look inside the folder.
See also Files.RenameFile to rename a file.
On Windows, if the destination path is relative, it is applied to the current process' working directory. See Process.SetCurrentDirectory to change that.
This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.
Examples
Move a file:
MBS( "Files.MoveFile"; "C:\Users\Christian\Desktop\test1.txt"; "C:\Users\Christian\Desktop\test2.txt")
See also
- Files.CopyFile
- Files.CopyFiles
- Files.ReadFile
- Files.RenameFile
- Files.RevealFile
- Files.WriteFile
- Path.FileMakerPathToNativePath
- Process.SetCurrentDirectory
- WebDownloadDelegate.Path
- WebDownloadDelegate.SetFolder
Release notes
- Version 13.0
- Improved Files.MoveFile on Linux to allow you to specify a folder as destination.
- Version 12.0
- Added workaround for Files.MoveFile and Files.CopyFile when it fails with MAX_PATH error.
- Version 10.0
- Fixed an issue for Files.MoveFile and Files.CopyFile where unability to move an old file to trash caused a problem on AFP volumes.
- Version 8.5
- Improved error handling for Files.CopyFile and Files.MoveFile.
- Rewrote Files.CopyFile and Files.MoveFile for Mac/iOS to better overwrite files.
- Version 7.0
- Added progress window option to Files.CopyFile and Files.MoveFile for Windows.
Example Databases
Blog Entries
- MBS Plugin Advent calendar: 12 - Files
- MBS FileMaker Plugin, version 13.0pr8
- MBS FileMaker Plugin, version 11.6pr4
- MBS FileMaker Plugin, version 11.6pr3
- MBS FileMaker Plugin, version 9.6pr2
- FileMaker 18 File Script Steps vs. BinaryFile functions
- MBS FileMaker Plugin, version 8.5pr7
- MBS FileMaker Plugin, version 8.5pr2
- Comparing Base Elements Plugin to MBS FileMaker Plugin
- MBS FileMaker Plugin, version 7.0pr3
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 26th February 2023