Filesharing Service Walk Task¤
task api name:
walk
The walk task recursively lists all files from all subdirectories under the specified URL path. This is useful when you need to discover all files available in a directory tree, returning a list of complete nf://... URLs for each file found. The task skips hidden files (starting with .) and special directories (containing __).
Using it from Python¤
from norfab.core.nfapi import NorFab
with NorFab(inventory="./inventory.yaml") as nf:
client = nf.make_client()
reply = client.run_job(
service="filesharing",
task="walk",
workers="any",
kwargs={"url": "nf://"},
)
print(reply)
Using it from nfcli¤
NORFAB CLI exposes File Sharing under the file command group.
nf#man tree file
root
└── file: File sharing service
└── walk: Walk directory tree recursively
nf#
API Reference¤
Recursively list all files from all subdirectories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL path starting with 'nf://' to walk directories |
required |
Returns:
| Type | Description |
|---|---|
Result
|
Result containing list of all file paths or error message |
Source code in norfab\workers\filesharing_worker\filesharing_worker.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |