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

While migrating a large amount of images from a dropbox account to a Nextcloud 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
       --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

If you want to spread it, the best would be to describe better usage, and more important issues that it solves (problems) and benefits for the users to use it.

My 2 cent

I learned long ago trying to convince people to use something is a zero sum game.

When I need a tool I google it and if I don’t find anything I like and the itch is big enough I will probably develop something that fits my style of working or fixing a problem(s).

My use-case is an outlier… I run a BIG multi-TB imageDB I have developed over the last 7 years to automatically handle photoshootings and mine and others social media presence ie. auto-posting to numerous sites N times/day (until covid I was a fulltime photographer… now part time and again IT fixer).

I use cloud-cli as the glue in my backend imageDB/workflow to Nextcloud.

I release it as-is so that maybe you and others find it useful… or not.

Have fun!