UploadFolder
Calling this method triggers an upload of files and subfolders recursively from a given folder on the host OS system. The default working directory is "/images/history" which is mapped to the "/etc/aziot/images/history" folder on the host OS system.
Files are uploaded to blob storage (localblobstorage). Since the default container is "syncfiles", the uploaded files are by default uploaded to cloud, because the "syncfiles" container is configured to upload automatically. However, if the destination container is changed, the files are not necessarily uploaded to cloud.
By default, all files are uploaded into the following blob structure (per default in the "syncfiles" container): "<device id>/Images/<destination folder>" where <destination folder> is the same as <source folder>, unless it has been overridden by setting "destinationFolder".
It is possible to apply metadata to the uploaded blob files. This is desirable if the uploaded files must be ingested by Microsoft Data Explorer (ADX), since the metadata potentially specifies the database, data format and mappings used in the ingestion.
Method Name:
UploadFolders
Payload:
The direct command requires a source folder of the files to upload. The source folder is relative to the "/images/history" folder. Optionally, it is possible to specify the destination folder. If it is not set, the same folder name as the source folder is used. The default destination container is the "syncfiles" container, that is used for uploading files to cloud. If is possible to override the destination container.
{
    "sourceFolder": "2023-05-09",
    "destinationFolder": "NewFolder",
    "destinationContainer": "NewContainer"
    "metadata": [
        "kustoTable": "table",
        "kustoDataFormat": "json",
        "kustoIngestionMappingReference": "mapping"
    ]
}This payload configures an upload of all files and folders from the "/images/history/2023-05-09" folder into blob storage. The files are uploaded as blobs to the container "NewContainer" and into blobs with the path "<device id>/Images/2023-05-09". Properties are added to all uploaded blob files, with the metadata specified in the payload.
Return value
The direct command returns an OperationResult that indicates either success or failure.
Last updated
Was this helpful?