You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,12 @@ for file in crawler:
67
67
68
68
> ↑ This recursively prints all files in the current directory, including files in nested directories. At each iteration, we get a new [`Path` object](https://docs.python.org/3/library/pathlib.html#basic-use).
69
69
70
+
By default, crawlers iterate over files only. If you need every filesystem entity found under the base directory, pass `only_files=False`:
71
+
72
+
```python
73
+
crawler = Crawler('.', only_files=False)
74
+
```
75
+
70
76
71
77
## Applying a Function to Each Path
72
78
@@ -98,6 +104,8 @@ To set the file extensions you are interested in, use the `extensions` parameter
98
104
crawler = Crawler('.', extensions=['.txt']) # Iterate only on .txt files.
99
105
```
100
106
107
+
> ⓘ The `extensions` parameter is available only in the default file-only mode, so it cannot be combined with `only_files=False`. `PythonCrawler` is always file-only.
108
+
101
109
Also, if you only need Python files, you can use a special class to bypass them only, without specifying extensions:
0 commit comments