[announce] cloud-cli 1.20 - command line script to perform file, share and user operations

A linux/unix/WSL2 bash script to perform basic file, share and user operations.

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|-C 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

       share operations:
       --list-shares         list all shares
       --create-share path   create share for specified path
       --update-share id     update share for specified id
       --delete-share id     delete share for specified id
       --share-type type     share type (default: 3)
       --share-perms type    share permissions to use on the share (default: 17)
       --share-pass text     share password to protect the public share
       --share-expire text   share expire per date or in days [NNN|YYYY-MM-DD]
       --share-upload bool   share allow public upload to a public shared [0|false|1|true]
       --share-note text     share a note text
       --share-with type     share with user or group id

       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|default|numGB|numMB|numKB|num]
       --user-status text    enable/disable user profile [enable|1|disable|0]

       misc helpers:
       --sort-on|-S text     sort --list|--search on a specific output field
                             [date|size|file][:[asc|desc]] (default: file:ascending)
       --yes|-y              confirm required operation
                             [--copy-file|--move-file] if destination exists
       --csv                 output csv instead of fancy format

       --quiet|-q            quiet mode
       --verbose|-v          verbose
       --help|-h             help

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


Examples (file operations):

$ cloud-cli --list path
$ cloud-cli --upload local-file
$ cloud-cli --download cloud-file --local-dir /tmp
$ cloud-cli --pipe cloud-file | grep text-string
$ cloud-cli --delete cloud-file
$ 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 (share operations):

$ cloud-cli --list-shares
$ cloud-cli --create-share path --share-type 3 --share-perms 17 
$ cloud-cli --update-share 19 --share-expire 2022-12-31 --share-pass "secret"
$ cloud-cli --delete-share 19

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 --yes

URL: https://lightaffaire.com/code

Constructive feedback always appreciated.



Glad to see you are still working on this. :sunglasses:

Thank you. It now does enough that i use it for sharing certain image folders from my internal NAS to customers.

My plan now is too add some picdrop like functionality to the shared folders (favourites and comments (note) per image). If anyone is interested in discussing picdrop features that would be nice to have in nextcloud please contact me.

Are you using particular commands within your Linux desktop as keybindings or as custom actions (Xfce, Gnome, KDE), etc? Would be interested to learn more about how you use this vs. the standard desktop app.

All command line so I can script as needed.

I have my own photography workflow which I have spent 5 years perfecting to the way I like to work.

The storage is on a dual site synology NAS and admin is via linux or WSL2 on windows.

Here is the basic workflow for importing, sorting, renaming, backup to 1-N local disks (when on location), backup to the main local/remote NAS (DR to secondary done via DR scripts) and automatic share to customer via nextcloud.

Here is the rough off the top of my head list of commands I usually use:

# 1. imports, generates checksums for all images and splits them into jpg/ raw/ resized/ folders
# 2. backup work folder to a usb mounted disk in WSL2 (E: = /mnt/e) and to windows dir /images
$ piximport --cust "iain" --type "pay" --job-name "sardinia" --job-date "20221009" --copy-work-to-disk "e: /images"

# after sorting and deleting unwanted images in the resized/ folder simply sync and rename to YYYYMMDD_NNN.extension
$ cd /imgs/pay/2022/10/09_la_sardinia
$ piximport --resync --rename --yes

# sync the folder to a 1-N remote hosts using 8 parallel uploads and ~32Mbps (4x8) bandwidth
$ piximport --sync-work-to-host "lightaffaire.com" --filter-subdirs "resized jpg raw" --transfer 8 --bw-limit 4M

# sync the resized folder to my nextcloud and send share info to customer in an Email
$ piximport --share-resized --share-expire "2022-10-30" --share-pass "secret123!" --share-email "customer@domain.com"

I usually spend 2-3 weeks on Location so needed a tool that could quickly import+sort+verify images (~150 images/minute) and easily generate multiple local and remote copies of my images. I spent a long time looking and then developed piximport which uses cloud-cli to automatically create shares.

If you have questions let me know,


1 Like