[announce] cloud-cli - command line client to perform file and user operations

I could not find a relevant category to post a command line utility so feel free to move it to the correct category.

While migrating a large amount of images from a dropbox account to a docker instance running on a Synology NAS server I needed todo some automated housekeeping so this command line client was born.

It is a linux/unix bash script to perform basic file and user operations using curl.

Usage: cloud-cli [options]
       --config-file file    config file (default: ~/.cloud-cli)

       --host|-H url         cloud host url https://[fqdn|ip][:port]
       --user|-U user        cloud username (for file operations)
       --pass|-P pass        cloud password (for file operations)
       --admin-user user     admin username (for user operations)
       --admin-pass pass     admin password (for user operations)
       --insecure|-I         ignore self signed SSL certs

       file operations:
       --list|-l path        list date time size name for path elements
FIX    --search|-s text      search files for text
       --upload|-u file      upload file
       --download|-d file    download file
       --delete|-D file      delete file
       --pipe|-p file        pipe file
       --move|-m file        move file
       --copy|-c file        copy file 
       --to|-t file          move/copy destination file
       --exists|-E path      check if file or directory exists
       --create-dir dir      create directory
       --delete-dir dir      delete directory

       --local-dir|-d dir    local directory (default: /tmp)
       --local-file|-f file  local file

       user operations:
       --list-users|-L       list all users (main fields)
       --list-user user      list a user (all fields)
       --search-user user    search for a user(s)
       --create-user user    create a user
       --update-user user    update a user
       --delete-user user    delete a user
       --user-pass text      user password
       --user-name text      user display name
       --user-email text     user email
       --user-group text     user group(s)
       --user-subadmin text  user groups which user is subadmin
       --user-lang text      user language  [format: iso 2 character code]
       --user-locale text    user locale [format: ab_YZ]
       --user-quota text     user quota [none|numGB|numMB|numKB|num]
       --user-status text    enable/disable user profile [enable|0|disable|1]

       misc helpers:
       --yes|-y              confirm required operation
                             [--delete|--delete-dir|--delete-user]
                             [--copy-file|--move-file] if destination exists
       --csv                 output csv instead of fancy format
                             [--list|--list-users]

Config file ~/.cloud-cli and remember chmod 600 ~/.cloud-cli

Host="https://yoursite.com:443"
AdminUser="your-admin-username"
AdminPass="your-admin-password"
User="your-username"
Pass="your-password"
# Insecure="--insecure"
# LocalDir="/path"
# ConfirmOperation=1
# OverwriteFile=1
# CsvFormat=1

Examples (file operations):

$ cloud-cli --list path
$ cloud-cli --upload local-file
$ cloud-cli --download cloud-file --local-dir /tmp
$ cloud-cli --delete cloud-file
$ cloud-cli --pipe cloud-file | grep text-string
$ cloud-cli --copy cloud-file --to copy-of-file
$ cloud-cli --move cloud-file --to move-to-file
$ cloud-cli --exists cloud-file
$ cloud-cli --create-dir cloud-dir
$ cloud-cli --delete-dir cloud-dir

Examples (user operations):

$ cloud-cli --list-users
$ cloud-cli --create-user username --user-pass password [--user-KEY VALUE]
$ cloud-cli --update-user username --user-lang de --user-quota 5GB
$ cloud-cli --update-user username --user-status disable
$ cloud-cli --delete-user username

URL: https://lightaffaire.com/code

Constructive feedback always appreciated.

Iain

2 Likes