MD_LIST_FILES
MD_LIST_FILES() lists files and folders at a cloud storage path.
note
MD_LIST_FILES() supports:
s3://azure://az://
It does not accept r2://, gcs://, or gs:// paths, but MotherDuck can still query those storage providers normally.
Syntax
FROM md_list_files('<path>');
Output
| Column Name | Data Type | Value |
|---|---|---|
name | VARCHAR | File or folder name relative to the requested prefix |
type | VARCHAR | Entry type, such as FILE or FOLDER |
size | UBIGINT | File size in bytes; NULL for folders |
last_modified | TIMESTAMP WITH TIME ZONE | Last modification time; NULL for folders |
Example usage
FROM md_list_files('s3://us-prd-motherduck-open-datasets/');
FROM md_list_files('azure://my-container/raw/');
Notes
- For private storage, make sure an appropriate secret is available. See CREATE SECRET.
- For S3 bucket discovery by secret, use
MD_LIST_BUCKETS_FOR_SECRET().