---
title: exclusiveCreate
framework: system
role: symbol
role_heading: Type Property
path: system/filedescriptor/openoptions/exclusivecreate
---

# exclusiveCreate

Indicates that opening the file creates the file, expecting that it doesn’t exist.

## Declaration

```swift
static var exclusiveCreate: FileDescriptor.OpenOptions { get }
```

## Mentioned in

Adopting Swift File Options

## Discussion

Discussion If this option and create are both specified and the file exists, doc:FileDescriptor/open(_:_:options:permissions:retryOnInterrupt:)-2266j returns an error instead of creating the file. You can use this, for example, to implement a simple exclusive-access locking mechanism. If this option and create are both specified and the last component of the file’s path is a symbolic link, doc:FileDescriptor/open(_:_:options:permissions:retryOnInterrupt:)-2266j fails even if the symbolic link points to a nonexistent name. The corresponding C constant is O_EXCL.

## See Also

### Specifying Options

- [append](system/filedescriptor/openoptions/append.md)
- [closeOnExec](system/filedescriptor/openoptions/closeonexec.md)
- [create](system/filedescriptor/openoptions/create.md)
- [eventOnly](system/filedescriptor/openoptions/eventonly.md)
- [exclusiveLock](system/filedescriptor/openoptions/exclusivelock.md)
- [noFollow](system/filedescriptor/openoptions/nofollow.md)
- [nonBlocking](system/filedescriptor/openoptions/nonblocking.md)
- [sharedLock](system/filedescriptor/openoptions/sharedlock.md)
- [symlink](system/filedescriptor/openoptions/symlink.md)
- [truncate](system/filedescriptor/openoptions/truncate.md)
