Files and metadata

Overview

Use the following commands to manage files and metadata on the CGC.

files list

Get a list of files in the specified project with specified properties that you can access. Note that the ID of a file is not the same as its filename. The ID is a hexadecimal string automatically assigned to a file in a project.

Usage:
  sb files list [--project <project_value>] [--public] [--filenames <filenames_value> ...] [--metadata <metadata_value> ...] [--origin <origin_value>] [--tags <tags_value> ...]
  [flags]

Flags:
      --project string          Retrieve the files belonging to the specified project.
      --public                  Retrieve publicly available files.
      --filenames stringSlice   List files with names that match the exact complete string.
      --metadata stringSlice    List only files  that have the specified value in the given metadata key.
      --origin string           List only files produced by the given task (provide task ID).
      --tags stringSlice        List only files tagged with this exact complete string.
  -h, --help                    help for list

files get

Get details of the specified file. Note that the ID of a file is not the same as its filename. You can obtain the file_id by listing all files in a specified project.

Usage:
  sb files get <file_id> [flags]

Arguments:
      file_id   ID of the file.

Flags:
  -h, --help   help for get

files copy

Copy the specified file to a new project. Files retain their metadata when copied but may be assigned new names in their target project.

Note that the ID of a file is not the same as its filename. You can obtain the file_id by listing all files in a specified project.

To make this call, you should have copy permission within the project from which you are copying the file.

Usage:
  sb files copy <file_id> --project <project_value> [--name <name_value>] [flags]

Arguments:
      file_id   ID of the file.

Flags:
      --project string   The name of the project to which you want to copy the file.
      --name string      An optional new name for the file.
  -h, --help             help for copy

files update

Update the name, the full set of metadata, and/or tags for the specified file.

Usage:
  sb files update <file_id> [--name <name_value>] [--metadata <metadata_value> ...] [--tag <tag_value> ...] [flags]

Arguments:
      file_id   ID of the file.

Flags:
      --name string            The new name for the file.
      --metadata stringSlice   The metadata key(s) and their values that you want to update.
      --tag stringSlice        The tag(s) that you want to update.
  -h, --help                   help for update

files url

Get a URL that you can use to download the specified file.

Usage:
  sb files url <file_id> [flags]

Arguments:
      file_id   ID of the file.

Flags:
  -h, --help   help for url

files delete

Delete the specified file.

Usage:
  sb files delete <file_id> [flags]

Arguments:
      file_id   ID of the file.

Flags:
  -h, --help   help for delete

files metadata get

Returns the metadata values for the specified file.

Usage:
  sb files metadata get <file_id> [flags]

Arguments:
      file_id   ID of the file.

Flags:
  -h, --help   help for get

files metadata edit

Modifies the metadata for the specified file.

Usage:
  sb files metadata edit <file_id> --metadata <metadata_value> ... [flags]

Arguments:
      file_id   ID of the file.

Flags:
      --metadata stringSlice   The metadata keys and their values that you want to modify.
  -h, --help                   help for edit

files metadata overwrite

Overwrites the metadata for the specified file. Note that unlike the edit command, this command fully overwrites the values for all metadata fields. This means that when you run this command, you must enter values for every key required to specify the metadata, even if the values for some keys are unchanged. If you don't specify a value for a given metadata field, then any existing value for that field will be removed.

Usage:
  sb files metadata overwrite <file_id> --metadata <metadata_value> ... [flags]

Arguments:
      file_id   ID of the file.

Flags:
      --metadata stringSlice   The metadata key(s) and their values that you want to modify.
  -h, --help                  help for overwrite