Files.CreateHardLink
--------------------

Creates a new hard link.

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

MBS( "Files.CreateHardLink"; DestPath; TargetPath ) 

**MBS**( **"Files.CreateHardLink";** /\* Creates a new hard link. \*/  
**$DestPath**; /\* The path where to create the hard link file.e.g. "/Users/cs/Desktop/test.rtf" \*/   
**$TargetPath**) /\* The target path for the link.e.g. "/Users/cs/Desktop/todo.rtf" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| DestPath | The path where to create the hard link file. | "/Users/cs/Desktop/test.rtf" |
| TargetPath | The target path for the link. | "/Users/cs/Desktop/todo.rtf" |

### Result

Returns OK or error.

### Description

Creates a new hard link.  
On success, you get two directory entries which point to same data on disk.  
For Macs works with file and folders.   
Be aware that not all applications are aware to handle hard links for folders correctly!  
  
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

Creates a hard link:

 MBS ( "Files.CreateHardLink"; "/Users/cs/Desktop/test.rtf"; "/Users/cs/Desktop/todo.rtf" )  
Creates a hard link on Wijndows:

 MBS ( "Files.CreateHardLink"; "C:\\Users\\Christian\\Desktop\\other.jpg"; "C:\\Users\\Christian\\Desktop\\test.jpg")  
### See also

- [Files.CreateAlias](FilesCreateAlias.md)
- [Files.ResolveAlias](FilesResolveAlias.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)

### Blog Entries

- [MBS FileMaker Plugin 6.3 for OS X/Windows](https://www.mbsplugins.de/archive/2016-07-12/MBS_FileMaker_Plugin_63_for_OS/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.3pr2](https://www.mbsplugins.de/archive/2016-06-10/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 7th June 2016 , last changed 7th June 2016

  
[Files.CreateDirectory](FilesCreateDirectory.md) - [Files.CreateSymbolicLink](FilesCreateSymbolicLink.md)

[HTML Version](FilesCreateHardLink.shtml)