GCS Listing
In order to list files in Google Storage (GCS) bucket you need to execute
connect list gcs
followed by one mandatory parameter:
--bucket
then the GCS bucket name
You can also provide an optional folder with:
-d, --folder
then the folder
Depending on the type of authentication you need to either use --auth-json
for key based authentication
or use the service account assigned to the instance (if the server is running on GCP).
Authentication with auth JSON
Section titled “Authentication with auth JSON”To use JSON key for the authentication you need to provide:
--auth-json
then the path to the file containing the auth JSON
For example:
$ connect list gcs --auth-json /path/to/key-file.json --bucket my-gcs-bucket2025/05/22 12:42:09 INFO Listing gcs://my-gcs-bucket/d--------- 0 folder1/-rw-rw-r-- 1024 Sep 15 21:27 file1.txt-rw-rw-r-- 1024 Sep 15 21:27 file2.txt-rw-rw-r-- 1024 Sep 15 21:27 file3.txt
Application Default Credentials (ADC)
Section titled “Application Default Credentials (ADC)”To authenticate with Application Default Credentials (ADC) you need to
set GOOGLE_APPLICATION_CREDENTIALS
environment variable that points to the key file.
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/key-file.json"
Then you can omit providing the key file as it will be obtained from the environment variable. For example:
$ connect list gcs --bucket my-gcs-bucket2025/05/22 12:44:59 INFO Listing gcs://my-gcs-bucket/d--------- 0 folder1/-rw-rw-r-- 1024 Sep 15 21:27 file1.txt-rw-rw-r-- 1024 Sep 15 21:27 file2.txt-rw-rw-r-- 1024 Sep 15 21:27 file3.txt
For user credentials, ADC can be set by running Following
$ gcloud auth application-default login
Once authenticated you can connect without specifying the JSON key.
$ connect list gcs --bucket my-gcs-bucket2025/05/22 12:45:10 INFO Listing gcs://my-gcs-bucket/d--------- 0 folder1/-rw-rw-r-- 1024 Sep 15 21:27 file1.txt-rw-rw-r-- 1024 Sep 15 21:27 file2.txt-rw-rw-r-- 1024 Sep 15 21:27 file3.txt
Target folder
Section titled “Target folder”You can also specify the optional target folder to list with:
-d, --folder
remote folder name
If you don’t specify the folder, the command will list root folder of the bucket.
For example:
$ connect list gcs --bucket my-gcs-bucket -d folder12025/05/22 12:51:33 INFO Listing gcs://my-gcs-bucket/folder1/-rw-rw-r-- 0 May 22 12:50 folder1/-rw-rw-r-- 1024 May 22 12:51 folder1/file1.txt-rw-rw-r-- 1024 May 22 12:51 folder1/file2.txt-rw-rw-r-- 1024 May 22 12:52 folder1/file3.txt
All GCS List Options
Section titled “All GCS List Options”Usage: connect list gcs [command] [flags]
Flags: --auth-json string GCS authentication json file --bucket string GCS bucket
Global Flags: -d, --folder string Folder to list files --godebug Turns on debug mode --help Prints help for the command --log-format string Log output format: text|json (default "text") --no-color Do not use colors in logs --quiet Makes no output
Errors
Section titled “Errors”Please check here for information on the possible errors.