---
title: "init(fileURLWithPath:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/url/init(fileurlwithpath:)"
---

# init(fileURLWithPath:)

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

## Declaration

```swift
init(fileURLWithPath path: String)
```

## Parameters

- `path`: The location in the file system.

## Discussion

Discussion If the path is an empty string, the system interprets it as “.”.

## See Also

### Creating a file URL from a string path

- [init(filePath:directoryHint:relativeTo:)](foundation/url/init(filepath:directoryhint:relativeto:).md)
- [URL.DirectoryHint](foundation/url/directoryhint.md)
- [init(fileURLWithPath:isDirectory:)](foundation/url/init(fileurlwithpath:isdirectory:).md)
- [init(fileURLWithPath:relativeTo:)](foundation/url/init(fileurlwithpath:relativeto:).md)
- [init(fileURLWithPath:isDirectory:relativeTo:)](foundation/url/init(fileurlwithpath:isdirectory:relativeto:).md)
- [init(fileURLWithFileSystemRepresentation:isDirectory:relativeTo:)](foundation/url/init(fileurlwithfilesystemrepresentation:isdirectory:relativeto:).md)
- [init(fileReferenceLiteralResourceName:)](foundation/url/init(filereferenceliteralresourcename:).md)
- [init(filePath:directoryHint:)](foundation/url/init(filepath:directoryhint:).md)
