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: _build/reference/589-file-dirwalk.markdown
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,10 @@
1
1
# DIRWALK
2
2
3
-
> DIRWALK directory[, wildcards][USE ...]
3
+
> DIRWALK dir[, wildcards][USE f(x)]
4
4
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.
7
6
8
-
## Example 1: Print all files
7
+
###Example 1: Print all files
9
8
10
9
```
11
10
FUNC PRNF(x)
@@ -16,7 +15,7 @@ END
16
15
DIRWALK "." USE PRNF(x)
17
16
```
18
17
19
-
## Example 2: Create a list of all files
18
+
###Example 2: Create a list of all files
20
19
21
20
```
22
21
FUNC ListFiles(x)
@@ -31,7 +30,7 @@ for n in FileList
31
30
next
32
31
```
33
32
34
-
## Example 3: Search for a certain file using wildcards
33
+
###Example 3: Search for a certain file using wildcards
35
34
36
35
```
37
36
FUNC ListFiles(x)
@@ -46,7 +45,7 @@ for n in FileList
46
45
next
47
46
```
48
47
49
-
## Example 4: Search a certain file using user defined function
48
+
###Example 4: Search a certain file using user defined function
0 commit comments