<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URL/init(filePath:directoryHint:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation3URLV8filePath13directoryHintACSg6System04FileD0V_AC09DirectoryF0Otcfc"
  },
  "title" : "init(filePath:directoryHint:)"
}
-->

# init(filePath:directoryHint:)

Creates a file URL that references a file path.

```
init?(filePath path: FilePath, directoryHint: URL.DirectoryHint = .inferFromPath)
```

## Parameters

`path`

The location in the file system.

`directoryHint`

A hint to the initializer to indicate whether the path is a directory, or to instruct the initializer to make this determination.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)