Files.SetHidden
---------------

Sets the hidden state for a file or folder.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Files](component_Files.md) | [7.1](newinversion71.md) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ❌ No |

MBS( "Files.SetHidden"; Path; Value ) 

**MBS**( **"Files.SetHidden";** /\* Sets the hidden state for a file or folder. \*/  
**$Path**; /\* The native path to the file or folder to be checked.e.g. "/Users/John/Desktop/test.txt" \*/   
**$Value**) /\* The new state.  
Pass 1 to hide file or 0 to unhide file.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | The native path to the file or folder to be checked. | "/Users/John/Desktop/test.txt" |
| Value | The new state.   Pass 1 to hide file or 0 to unhide file. | 1 |

### Result

Returns OK or error.

### Description

Sets the hidden state for a file or folder.  
If a file is hidden due to having a "." at the beginning of a name on macOS, you can’t unhide it by this function. You need to rename the file in this case.  
  
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

Hide a file:

 MBS ("Files.SetHidden"; "/Users/cs/Desktop/Changes.rtf"; 1)  
Hide the ScriptErrors.log log file from FileMaker:

 MBS ( "Files.SetHidden"; MBS ("[Path.AddPathComponent](PathAddPathComponent.md)"; MBS ("[Folders.UserDocuments](FoldersUserDocuments.md)"); "ScriptErrors.log"); 1 )  
### See also

- [Files.IsHidden](FilesIsHidden.md)
- [Folders.UserDocuments](FoldersUserDocuments.md)
- [Path.AddPathComponent](PathAddPathComponent.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)

### Release notes

- **Version 7.1**
    - Added [Files.IsHidden](http://www.mbsplugins.eu/FilesIsHidden.shtml) and [Files.SetHidden](http://www.mbsplugins.eu/FilesSetHidden.shtml).

### Blog Entries

- [MBS FileMaker Plugin, version 7.1pr4](https://www.mbsplugins.de/archive/2017-03-06/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 1st March 2017 , last changed 14th March 2024

  
[Files.SetFinderLabel](FilesSetFinderLabel.md) - [Files.SetModificationDate](FilesSetModificationDate.md)

[HTML Version](FilesSetHidden.shtml)