---
title: "init(_:isDirectory:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/url/init(_:isdirectory:)"
---

# init(_:isDirectory:)

Creates a file URL that references the local file or directory at the file path you specify.

## Declaration

```swift
init?(_ path: FilePath, isDirectory: Bool)
```

## Parameters

- `path`: The location in the file system.
- `isDirectory`: A Boolean value that indicates whether the location is a directory.

## Discussion

Discussion note: This method avoids file system I/O to determine if the path is to a directory. When you know that information, prefer this method to initializers without the parameter.

## See Also

### Creating a file URL from a file path

- [init(_:)](foundation/url/init(_:).md)
- [FilePath](system/filepath.md)
