FSEvents.CreateRelativeToDevice
-------------------------------

Creates a new FSEvents monitor relative to a device.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [FSEvents](component_FSEvents.md) | [6.0](newinversion60.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ❌ No |

MBS( "FSEvents.CreateRelativeToDevice"; DeviceID; PathList; sinceWhen { ; Flags; Latency } ) 

**MBS**( **"FSEvents.CreateRelativeToDevice";** /\* Creates a new FSEvents monitor relative to a device. \*/  
**$DeviceID**; /\* The device ID.   
Either a number or the path to a file/folder of that device.e.g. "/" \*/   
**$PathList**; /\* List of folders to watch.  
(or just one path)e.g. $path \*/   
**$sinceWhen**; /\* The event ID from where to start. Can be the latest ID you saw last time or you pass "now" to start with now.e.g. "now" \*/   
**$Flags**; /\* Optional; The flags. Can be a combination of NoDefer, WatchRoot, IgnoreSelf, FileEvents or MarkSelf.e.g. "IgnoreSelf,FileEvents" \*/   
**$Latency**) /\* Optional; The latency.e.g. 2 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| DeviceID | The device ID.    Either a number or the path to a file/folder of that device. | "/" |  |
| PathList | List of folders to watch.   (or just one path) | $path |  |
| sinceWhen | The event ID from where to start. Can be the latest ID you saw last time or you pass "now" to start with now. | "now" |  |
| Flags | The flags. Can be a combination of NoDefer, WatchRoot, IgnoreSelf, FileEvents or MarkSelf. | "IgnoreSelf,FileEvents" | Optional |
| Latency | The latency. | 2 | Optional |

### Result

Returns reference number or error.

### Description

Creates a new FSEvents monitor relative to a device.  
You can only pass one path in the pathList. Pass empty text there to watch the root of the device.  
### Examples

Watch root device with root folder since now:

 MBS ("FSEvents.CreateRelativeToDevice"; "/"; ""; "now")  
### See also

- [FSEvents.Create](FSEventsCreate.md)
- [FSEvents.DeviceBeingWatched](FSEventsDeviceBeingWatched.md)
- [FSEvents.LastEventIdForDeviceBeforeTime](FSEventsLastEventIdForDeviceBeforeTime.md)

This function checks for a license.

Created 29th November 2015 , last changed 17th July 2022

  
[FSEvents.Create](FSEventsCreate.md) - [FSEvents.CurrentEventId](FSEventsCurrentEventId.md)

[HTML Version](FSEventsCreateRelativeToDevice.shtml)