Media Commands#

synadm media#

Manage local and remote media.

synadm media [OPTIONS] COMMAND [ARGS]...

delete#

Delete local media by ID, size or age

To delete cached remote media, use synadm media purge

synadm media delete [OPTIONS]

Options

-i, --media-id <media_id>#

The media with this specific media ID will be deleted.

-d, --before-days <before_days>#

Delete all media that was last accessed before this number of days ago.

-b, --before <before>#

Delete all media that was last accessed before this date/time. Eg. ‘2021-01-01’, see above for available date/time formats.

-t, --before-ts <before_ts>#

Delete all media that was last accessed before this unix timestamp in ms.

--size, --kib <size>#

Delete all media that is larger than this size in KiB (1 KiB = 1024 bytes).

--delete-profiles, --all#

Also delete files that are still used in image data (e.g user profile, room avatar). If set, these files will be deleted too. Not valid when a specific media is being deleted (–media-id)

list#

List local media by room or user.

synadm media list [OPTIONS]

Options

-r, --room-id <room_id>#

List all media in room with this room ID (‘!abcdefg’).

-u, --user-id <user_id>#

List all media uploaded by user with this matrix ID (@user:server).

-f, --from <from_>#

Offset media listing by given number. This option is also used for pagination but only supported together with –user-id.

Default:

0

-l, --limit <limit>#

Limit media listing to given number. This option is only supported together with –user-id.

Default:

100

-s, --sort <sort>#

The method by which to sort the returned list of media. If the ordered field has duplicates, the second order is always by ascending media_id, which guarantees a stable ordering. This option is only supported together with –user-id.

Options:

media_id | upload_name | created_ts | last_access_ts | media_length | media_type | quarantined_by | safe_from_quarantine

-R, --reverse#

Direction of media order. If set it will reverse the sort order of –order-by method. This option is only supported together with –user-id.

--datetime, --dt, --timestamp, --ts#

Display created and last accessed timestamps in a human readable format, or as a unix timestamp in milliseconds. This option only applies to user media and is ignored with room media. [default: datetime].

protect#

Protect specific media from being quarantined.

synadm media protect [OPTIONS] MEDIA_ID

Arguments

MEDIA_ID#

Required argument

purge#

Purge old cached remote media

To delete local media, use synadm media delete

synadm media purge [OPTIONS]

Options

-d, --before-days <before_days>#

Purge all media that was last accessed before this number of days ago.

-b, --before <before>#

Purge all media that was last accessed before this date/time. Eg. ‘2021-01-01’, see above for available date/time formats.

-t, --before-ts <before_ts>#

Purge all media that was last accessed before this unix timestamp in ms.

quarantine#

Quarantine media in rooms, by users or by media ID.

synadm media quarantine [OPTIONS]

Options

-i, --media-id <media_id>#

The media with this specific media ID will be quarantined.

-r, --room-id <room_id>#

All media in room with this room ID (!abcdefg) will be quarantined.

-u, --user-id <user_id>#

All media uploaded by user with this matrix ID (@user:server) will be quarantined.

-U, --mxc-uri <mxc_uri>#

The MXC URI of the media to quarantine. Equivalent to passing media ID and server name if MXC URI is passed.

-s, --server-name <server_name>#

The server name of the media for quarantining remote media. If not used, quarantines local homeserver by specified –media-id.

unquarantine#

Remove media from quarantine.

synadm media unquarantine [OPTIONS]

Options

-i, --media-id <media_id>#

The media with this specific media ID will be removed from quarantine.

-U, --mxc-uri <mxc_uri>#

The MXC URI of the media to quarantine. Equivalent to passing media ID and server name if MXC URI is passed.

-s, --server-name <server_name>#

The server name of the media for unquarantining remote media. If not used, unquarantines local homeserver by specified –media-id.