Filing System Utilities: File Lister
What does this node do?
This node searches a folder (and optionally sub-folders) for files. optionally
may filter on a specific file and/or folder pattern.
The folder and files come from the computer and operating system that is
running Node-Red. AKA, the "host".
Outputs
By default, returns one message for each file found. The filename will be
in the msg.payload.
unless the Output Single Message
option is chosen.
If the Output Single Message option is chosen, the msg.payload will
contain an array of filenames.
Output filenames will contain the full file path if the Full Path
option is selected.
If the "Return file details" option is selected, each file output will be
an object. {"name":[filename], "stat": {"size":[fsize], ...}}
Inputs
-
Start Folder [start] String containing the start folder location to search
for files. Without a leading '/', will search from the location the node
is installed which is not terribly useful so it is preferred to use
absolute paths. e.g. /home/pi
Windows path names are also accepted. On Windows, you can use either form.
There is no need to escape backslashes.
Max path length is 1024
-
File Pattern [pattern] String that will be matched against the filenames.
Standard "glob" file patterns are allowed. Defaults to '*' which will return all files.
Max length is 1024
-
Folder Pattern [folders] String that will be matched against folder names.
Standard "glob" file patterns are allowed. Defaults to '*' which will match all
folders. Use the '!' to negate a folder - i.e. '!bin' means don't search the 'bin'
folder. Multiple patterns can be used so "*,!bin,!data" means 'search all subfolders
except 'bin' and 'data'. Max length is 1024
-
Files/Folder/b> [lstype] Drop down that allows you to choice to return just files,
'folders or both
-
Include hidden file/folders in output Checkbox. If selected, hidden files
and folders will processed.
-
Include full path in output Checkbox. If selected (the default),
the output payload will have the folder path prepended to the filename.
-
Output single message (array) Checkbox. If selected, only one msg will be
sent; the msg.payload will contain an array of filenames.
Otherwise, the default output is a single msg for each file found with
the msg.payload a string containing the filename.
-
Max. search depth Integer. Default 0 only searches the start folder.
Limits the depth of sub-folders that will be searched.
-
Return file details Checkbox. If selected, details of the files will be
returned as part of msg.payload
To override the configured options, pass in a msg with msg.payload like:
{"start":"/my/folder","pattern":"*.json"}
Any missing options will be picked up from the configured node.