Skip to main content

mr resource from-local

Create a Resource from a file already present on the server's filesystem. Differs from upload (which streams bytes over HTTP) in that the server reads the file in place. Useful for bulk-importing existing files or deploying pre-staged assets.

--path is required and is resolved inside the server's storage root, not on the host: a file staged at $FILE_SAVE_PATH/incoming/photo.jpg is --path /incoming/photo.jpg here. The name defaults to the file's base name. Re-running with a path a Resource already records returns that Resource unchanged rather than creating a second one, so a bulk import can be repeated safely.

With authentication enabled the command needs an admin account. Paths in the server's private storage (a top-level entry starting with _ or ., such as _exports/ or _job_replay_key, or any path with a .. segment) are refused for every account.

Usage​

mr resource from-local

Examples​

Create from a path under the server's storage root

mr resource from-local --path /incoming/photo.jpg

With metadata

mr resource from-local --path /imports/doc.pdf --name "Doc" --tags 3,7

Flags​

FlagTypeDefaultDescription
--pathstring``Local server path (required) (required)
--namestring``Resource name
--descriptionstring``Resource description
--tagsstring``Comma-separated tag IDs
--groupsstring``Comma-separated group IDs
--owner-iduint0Owner group ID
--metastring``Meta JSON string

Inherited global flags​

FlagTypeDefaultDescription
--jsonboolfalseOutput raw JSON
--no-headerboolfalseOmit table headers
--pageint1Page number for list commands (default page size: 50)
--quietboolfalseOnly output IDs
--serverstringhttp://localhost:8181mahresources server URL (env: MAHRESOURCES_URL)

Output​

Resource object with id

Exit Codes​

0 on success; 1 on any error

See Also​