---
source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs
---
PTH208 Use `pathlib.Path.iterdir()` instead.
 --> PTH208.py:3:1
  |
1 | import os
2 |
3 | os.listdir('.')
  | ^^^^^^^^^^
4 | os.listdir(b'.')
  |

PTH208 Use `pathlib.Path.iterdir()` instead.
 --> PTH208.py:4:1
  |
3 | os.listdir('.')
4 | os.listdir(b'.')
  | ^^^^^^^^^^
5 |
6 | string_path = '.'
  |

PTH208 Use `pathlib.Path.iterdir()` instead.
 --> PTH208.py:7:1
  |
6 | string_path = '.'
7 | os.listdir(string_path)
  | ^^^^^^^^^^
8 |
9 | bytes_path = b'.'
  |

PTH208 Use `pathlib.Path.iterdir()` instead.
  --> PTH208.py:10:1
   |
 9 | bytes_path = b'.'
10 | os.listdir(bytes_path)
   | ^^^^^^^^^^
   |

PTH208 Use `pathlib.Path.iterdir()` instead.
  --> PTH208.py:16:1
   |
15 | path_path = Path('.')
16 | os.listdir(path_path)
   | ^^^^^^^^^^
   |

PTH208 Use `pathlib.Path.iterdir()` instead.
  --> PTH208.py:19:4
   |
19 | if os.listdir("dir"):
   |    ^^^^^^^^^^
20 |     ...
   |

PTH208 Use `pathlib.Path.iterdir()` instead.
  --> PTH208.py:22:14
   |
20 |     ...
21 |
22 | if "file" in os.listdir("dir"):
   |              ^^^^^^^^^^
23 |     ...
   |
