<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.10.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/FileWrapper/init(path:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFileWrapper(im)initWithPath:"
  },
  "title" : "init(path:)"
}
-->

# init(path:)

Initializes a file wrapper instance whose kind is determined by the type of file-system node located by the path.

```
convenience init?(path: String)
```

## Parameters

`path`

Pathname of the file-system node the file wrapper is to represent.

## Return Value

File wrapper for `node`.

## Discussion

If `node` is a directory, this method recursively creates file wrappers for each node within that directory.

### Special Considerations

Beginning with OS X v10.6, the preferred method of referring to files is with a `file://` URL. Therefore, this method has been deprecated in favor of [`init(url:options:)`](/documentation/Foundation/FileWrapper/init(url:options:)-70161).

## See Also

[`preferredFilename`](/documentation/Foundation/FileWrapper/preferredFilename)

The preferred filename for the file wrapper object.

[`filename`](/documentation/Foundation/FileWrapper/filename)

The filename of the file wrapper object

[`fileAttributes`](/documentation/Foundation/FileWrapper/fileAttributes)

A dictionary of file attributes.



---

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)