Files.CanOpenFile
-----------------

Checks if plugin can read file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Files](component_Files.md) | [5.4](newinversion54.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Files.CanOpenFile"; Path ) 

**MBS**( **"Files.CanOpenFile";** /\* Checks if plugin can read file. \*/  
**$Path**) /\* The native file path to the file. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | The native file path to the file. | $path |

### Result

Returns 1, 0 or error.

### Description

Checks if plugin can read file.  
The plugin tries to open file exclusive. If that fails another application or FileMaker has the file open.  
Returns 1 if open was okay, 0 if file is busy or an error like permissions denied.  
  
If you just need to know whether you can open a file, you can just read it. Or test by opening with [BinaryFile.Open](BinaryFileOpen.md) function.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) 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](component_FileDialog.md) functions.  
For Server be aware that server has limited permissions and may not be able to access all files on a computer.  
### Examples

Check if file exists:

 Show Custom Dialog \["File exists"; MBS ( "Files.CanOpenFile"; "/Users/cs/Desktop/test.rtf" )\]  
### See also

- [BinaryFile.Open](BinaryFileOpen.md)
- [Files.ListOpenFiles](FilesListOpenFiles.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)

### Release notes

- **Version 16.2**
    - Improved [Files.CanOpenFile](https://www.mbsplugins.eu/FilesCanOpenFile.shtml) function to work better with shared home folder on Windows.

### Blog Entries

- [MBS FileMaker Plugin, version 16.2pr4](https://www.mbsplugins.de/archive/2026-04-28/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.4pr2](https://www.mbsplugins.de/archive/2015-10-15/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 20th October 2015 , last changed 15th August 2023

  
[Files.BSDVolumeName](FilesBSDVolumeName.md) - [Files.CopyFile](FilesCopyFile.md)

[HTML Version](FilesCanOpenFile.shtml)