The File List Action Component is to get a list of files that match the pattern.
Output payload | Description |
---|---|
cv.Payload |
Outputs the contents of the read directory as individual JSON objects. |
The contents of the directory will have the following data:
For example the pattern "icons/*"
might return something like this for each file:
{"IsDir":false,"ModTime":"2021-08-10T13:18:29.2577374+09:00","Name":"arrow_down.bmp","Path":"icons/arrow_down.bmp","" Size ":824}
Data | Description |
---|---|
IsDir | true for directories, false for files |
ModTime | Modification Date and Time |
Name | File name |
Path | File path |
Size | File size |
Component Properties
Name | Description |
---|---|
Pattern | The conditional expression to list files, e.g. icons/* . Note these folders are relative to actmgr/data |
IncFILE | Specify whether to include files or not |
IncDIR | Specify whether to include directories or not |
The pattern without a file path refers to the actmgr/data
folder, so all paths need to be relative to that folder. You can find more details about the paths on different operating systems here.
Note: The payload will contain the metadata for one file returned by the list each. If you follow the File List component with the Join component, you’ll get a payload with every file metadata joined together. In this case, you will get:
[
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"arrow_down.bmp",
"Path":"icons/arrow_down.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"arrow_left.bmp",
"Path":"icons/arrow_left.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"arrow_right.bmp",
"Path":"icons/arrow_right.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"arrow_up.bmp",
"Path":"icons/arrow_up.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"circle.bmp",
"Path":"icons/circle.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"correct.bmp",
"Path":"icons/correct.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"downloading_f1.bmp",
"Path":"icons/downloading_f1.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"downloading_f2.bmp",
"Path":"icons/downloading_f2.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"downloading_f3.bmp",
"Path":"icons/downloading_f3.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"error.bmp",
"Path":"icons/error.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"sad.bmp",
"Path":"icons/sad.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"smile.bmp",
"Path":"icons/smile.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"zigbee_off.bmp",
"Path":"icons/zigbee_off.bmp",
"Size":824
},
{
"IsDir":false,
"ModTime":"2017-12-14T17:23:11+08:00",
"Name":"zigbee_on.bmp",
"Path":"icons/zigbee_on.bmp",
"Size":824
}
]
Example: Uploading Captured Photo Files to Google Drive Automatically
Use the List component to get the array of images
The upload component will iterate through the files. Read in the Google Drive Upload component how to authenticate with Google Drive.
Delete the images in the folder after upload.
Need more help with this?
Join our slack community for help