Skip to content

Commit f2ec64d

Browse files
authored
Update 589-file-dirwalk.markdown
1 parent 75bba6f commit f2ec64d

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

_build/reference/589-file-dirwalk.markdown

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# DIRWALK
22

3-
> DIRWALK directory [, wildcards] [USE ...]
3+
> DIRWALK dir [, wildcards] [USE f(x)]
44
5-
Walk through the specified directories. The user-defined function must returns zero to stop the process.
6-
The user defined function takes `x` as a parameter. `x` contains information about the current file.
5+
Walk through the specified directory `dir` and its subdirectories. The user defined function `f(x)` takes `x` as a parameter. `x` contains information about the current file. `f(x)` must return zero to stop the process. `wildcards` can be used to filter the files.
76

8-
## Example 1: Print all files
7+
### Example 1: Print all files
98

109
```
1110
FUNC PRNF(x)
@@ -16,7 +15,7 @@ END
1615
DIRWALK "." USE PRNF(x)
1716
```
1817

19-
## Example 2: Create a list of all files
18+
### Example 2: Create a list of all files
2019

2120
```
2221
FUNC ListFiles(x)
@@ -31,7 +30,7 @@ for n in FileList
3130
next
3231
```
3332

34-
## Example 3: Search for a certain file using wildcards
33+
### Example 3: Search for a certain file using wildcards
3534

3635
```
3736
FUNC ListFiles(x)
@@ -46,7 +45,7 @@ for n in FileList
4645
next
4746
```
4847

49-
## Example 4: Search a certain file using user defined function
48+
### Example 4: Search a certain file using user defined function
5049

5150
```
5251
func SearchFile(x)
@@ -63,7 +62,7 @@ DIRWALK "." USE SearchFile(x)
6362
print path
6463
```
6564

66-
## Example 5: Using wilcards
65+
### Example 5: Using wilcards
6766

6867
```
6968
FUNC ListFiles(x)
@@ -78,7 +77,7 @@ for n in FileList
7877
next
7978
```
8079

81-
## Example 6: File list utility
80+
### Example 6: File list utility
8281

8382
~~~
8483

0 commit comments

Comments
 (0)