Skip to main content
The cockroach userfile list lists the files stored in the which match the , using a SQL connection. If no pattern is provided, all files in the specified (or default, if unspecified) user scoped file storage will be listed.

Required privileges

The user must have the CREATE on the target database. CockroachDB will proactively grant the user GRANT, SELECT, INSERT, DROP, DELETE on the metadata and file tables. A user can only view files in their own user-scoped storage, which is accessed through the used during the upload. CockroachDB will revoke all access from every other user in the cluster except users in the admin role.

Synopsis

View files:
View help:

Flags

FlagDescription
--cert-principal-mapA comma-separated list of <cert-principal:<db-principal mappings. This allows mapping the principal in a cert to a DB principal such as node or root or any SQL user. This is intended for use in situations where the certificate management system places restrictions on the Subject.CommonName or SubjectAlternateName fields in the certificate (e.g., disallowing a CommonName like node or root). If multiple mappings are provided for the same <cert-principal, the last one specified in the list takes precedence. A principal not specified in the map is passed through as-is via the identity function. A cert is allowed to authenticate a DB principal if the DB principal name is contained in the mapped CommonName or DNS-type SubjectAlternateName fields.
--certs-dirThe path to the containing the CA and client certificates and client key.

Env Variable: COCKROACH_CERTS_DIR
Default: ${HOME}/.cockroach-certs/
--echo-sqlReveal the SQL statements sent implicitly by the command-line utility.
--urlA to use instead of the other arguments.

Env Variable: COCKROACH_URL
Default: no URL
--user
-u
The that will own the client session.

Env Variable: COCKROACH_USER
Default: root

Examples

List all files in the default storage

If the file or directory is not specified, all files in the default user-scoped storage (userfile://defaultdb.public.userfiles_$user/) will be listed:

List a specific file

To list all files in a specified directory:

List files that match the provided pattern

To list all files that match a pattern, use *:

List files from a non-default userfile URI

If you (e.g., userfile://testdb.public.uploads):
Use the same URI to view it:

See also