-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist_files.py
37 lines (28 loc) · 840 Bytes
/
list_files.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import tempfile
import traceback
from simflow.control import Flow, run_flow
from simflow.sink import Console
from simflow.source import ListFiles
def main():
"""
Just runs some example code.
"""
# setup the flow
flow = Flow(name="list files")
listfiles = ListFiles()
listfiles.config["dir"] = str(tempfile.gettempdir())
listfiles.config["list_files"] = True
listfiles.config["list_dirs"] = False
listfiles.config["recursive"] = False
listfiles.config["regexp"] = ".*r.*"
flow.actors.append(listfiles)
console = Console()
console.config["prefix"] = "Match: "
flow.actors.append(console)
# run the flow
run_flow(flow, print_tree=True, cleanup=True)
if __name__ == "__main__":
try:
main()
except Exception as e:
print(traceback.format_exc())