Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Files.DeleteFolder
Deletes a file or folder directly without moving to trash.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Files | 4.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "Files.DeleteFolder"; Path ) More
Parameters
Parameter | Description | Example |
---|---|---|
Path | The native folder path to the item to be deleted. | "/Users/John/Desktop/test" |
Result
Returns OK or error message.
Description
Deletes a file or folder directly without moving to trash.Use Files.MoveToTrash to move files to trash which is often better as it allows users to undo the operation. Also Files.MoveToTrash usually works on files in use.
It is possible that the OS decides to not delete the file and fail (e.g. due to permission errors).
Folders are deleted recursively.
On Linux in v13.0 or newer, we try to delete the folder. If that fails, because the file is not empty, we will recursively delete the content. Once that is done, we try again. If something failed to delete inside the folder, the function will report the error about directory not being empty.
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
Delete a folder on desktop on Mac:
$r = MBS("Files.Delete"; "/Users/cs/Desktop/testing")
Delete a folder on desktop on Windows:
$r = MBS("Files.Delete"; "C:\Users\Christian\Desktop\testing")
See also
- Files.CreateDirectory
- Files.Delete
- Files.DeleteLater
- Files.MoveToTrash
- Path.FileMakerPathToNativePath
Release notes
- Version 13.0
- Changed Files.DeleteFolder for Linux to do recursive deletion.
Example Databases
Blog Entries
- MBS Plugin Advent calendar: 12 - Files
- Neues MBS Plugin 13.0 für Claris FileMaker
- MBS Plugin 13.0 for Claris FileMaker
- MBS FileMaker Plugin, version 13.0pr6
- Convert Office Files in FileMaker
- MBS Filemaker Plugin, version 4.2pr8
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 13th January 2023