> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# filesystem

# `prefect.utilities.filesystem`

Utilities for working with file systems

## Functions

### `create_default_ignore_file` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/\_\_init\_\_.py#L22](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/__init__.py#L22)</sup>

```python theme={null}
create_default_ignore_file(path: str) -> bool
```

Creates default ignore file in the provided path if one does not already exist; returns boolean specifying
whether a file was created.

### `filter_files` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/\_\_init\_\_.py#L37](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/__init__.py#L37)</sup>

```python theme={null}
filter_files(root: str = '.', ignore_patterns: Optional[Iterable[AnyStr]] = None, include_dirs: bool = True) -> set[str]
```

This function accepts a root directory path and a list of file patterns to ignore, and returns
a set of paths that excludes those that should be ignored.

The specification matches that of [.gitignore files](https://git-scm.com/docs/gitignore).

Returned paths are relative to `root` and use platform-native separators
by default. Set `as_posix=True` to return forward-slash-separated paths.
When `include_dirs=True`, ancestor directories of included files are also
included so directory traversal can reach those files.

### `tmpchdir` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/\_\_init\_\_.py#L105](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/__init__.py#L105)</sup>

```python theme={null}
tmpchdir(path: str)
```

Change current-working directories for the duration of the context,
with special handling for UNC paths on Windows.

### `filename` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/\_\_init\_\_.py#L130](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/__init__.py#L130)</sup>

```python theme={null}
filename(path: str) -> str
```

Extract the file name from a path with remote file system support

### `is_local_path` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/\_\_init\_\_.py#L140](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/__init__.py#L140)</sup>

```python theme={null}
is_local_path(path: Union[str, pathlib.Path, Any]) -> bool
```

Check if the given path points to a local or remote file system

### `to_display_path` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/\_\_init\_\_.py#L156](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/__init__.py#L156)</sup>

```python theme={null}
to_display_path(path: Union[pathlib.Path, str], relative_to: Optional[Union[pathlib.Path, str]] = None) -> str
```

Convert a path to a displayable path. The absolute path or relative path to the
current (or given) directory will be returned, whichever is shorter.

### `relative_path_to_current_platform` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/\_\_init\_\_.py#L173](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/__init__.py#L173)</sup>

```python theme={null}
relative_path_to_current_platform(path_str: str) -> Path
```

Converts a relative path generated on any platform to a relative path for the
current platform.

### `get_open_file_limit` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/\_\_init\_\_.py#L182](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/filesystem/__init__.py#L182)</sup>

```python theme={null}
get_open_file_limit() -> int
```

Get the maximum number of open files allowed for the current process
