Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5   8.0   8.1    Statistic  


Deletes a file directly without moving to trash.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Files 3.3 Yes Yes Yes Yes Yes

MBS( "Files.Delete"; Path )


Parameter Description Example value
Path The native file path to the file to be deleted. "/Users/John/Desktop/test.txt"


Returns OK or error message.


Deletes a file directly without moving to trash.
Works also for directories.
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).

Version 6.3 and newer support deleting a list of files. So you can pass a list of paths instead of just one. Stops at the first error.

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.


Delete a file on desktop on Mac:

$r = MBS("Files.Delete"; "/Users/cs/Desktop/testing.fp7")

Delete a file on desktop on Windows:

$r = MBS("Files.Delete"; "C:\Users\Christian\Desktop\testing.fp7")

Delete two files:

MBS("Files.Delete"; "/Users/cs/Desktop/test1.txt¶/Users/cs/Desktop/test2.txt")

Delete two files on Windows:

MBS("Files.Delete"; "C:\Users\Christian\Desktop\test1.txt¶C:\Users\Christian\Desktop\test2.txt")

See also

Example Databases

Files.CreationDate   -   Files.DeleteFolder

Feedback: Report problem or ask question.

MBS Xojo Plugins