Continuing the discussion from Activity on Folders:
cloudsend.sh is one handy script! Want to make sure it gets visibility and a dedicated topic here on the forum.
How do you use it?
- requires you’ve generated a shared, public link from Nextcloud or Owncloud.
- The bash script will send files & folders to that location.
- Passwords supported!
Project github page with script, examples, details
Help file:
$ ./cloudsend.sh --help
Tavinus Cloud Sender v2.2.0
Parameters:
-h | --help Print this help and exits
-q | --quiet Disables verbose messages
-V | --version Prints version and exits
-r | --rename <file.xxx> Change the destination file name
-g | --glob Disable input file checking to use curl globs
-k | --insecure Uses curl with -k option (https insecure)
-p | --password <pass> Uses <pass> as shared folder password
-e | --envpass Uses env var $CLOUDSEND_PASSWORD as share password
You can 'export CLOUDSEND_PASSWORD' at your system, or set it at the call
Please remeber to also call -e to use the password set
Use:
./cloudsend.sh [options] <inputPath> <folderLink>
CLOUDSEND_PASSWORD='MySecretPass' ./cloudsend.sh -e [options] <inputPath> <folderLink>
Passwords:
Cloudsend 2 changed the way password works
Cloudsend 0.x.x used the '-p' parameter for the Environment password (changed to -e in v2+)
Please use EITHER -e OR -p, but not both. The last to be called will be used
Env Pass > Set the variable CLOUDSEND_PASSWORD='MySecretPass' and use the option '-e'
Param Pass > Send the password as a parameter with '-p <password>'
Folders:
Cloudsend 2.2.0 introduces folder tree sending. Just use a directory as <inputPath>.
It will traverse all files and folders, create the needed folders and send all files.
Each folder creation and file sending will require a curl call.
Input Globbing:
You can use input globbing (wildcards) by setting the -g option
This will ignore input file checking and pass the glob to curl to be used
You MUST NOT rename files when globbing, input file names will be used
You MUST NOT send folders when globbing, only files are allowed
Glob examples: '{file1.txt,file2.txt,file3.txt}'
'img[1-100].png'
Send from stdin (pipe):
You can send piped content by using - or . as the input file name (curl specs)
You MUST set a destination file name to use stdin as input (-r <name>)
Use the file name '-' (a single dash) to use stdin instead of a given file
Alternately, the file name '.' (a single period) may be specified instead of '-' to use
stdin in non-blocking mode to allow reading server output while stdin is being uploaded
Examples:
CLOUDSEND_PASSWORD='MySecretPass' ./cloudsend.sh -e './myfile.txt' 'https://cloud.mydomain.net/s/fLDzToZF4MLvG28'
./cloudsend.sh './myfile.txt' 'https://cloud.mydomain.net/s/fLDzToZF4MLvG28'
./cloudsend.sh 'my Folder' 'https://cloud.mydomain.net/s/fLDzToZF4MLvG28'
./cloudsend.sh -r 'RenamedFile.txt' './myfile.txt' 'https://cloud.mydomain.net/s/fLDzToZF4MLvG28'
./cloudsend.sh -p 'MySecretPass' './myfile.txt' 'https://cloud.mydomain.net/s/fLDzToZF4MLvG28'
./cloudsend.sh -p 'MySecretPass' -r 'RenamedFile.txt' './myfile.txt' 'https://cloud.mydomain.net/s/fLDzToZF4MLvG28'
./cloudsend.sh -g -p 'MySecretPass' '{file1,file2,file3}' 'https://cloud.mydomain.net/s/fLDzToZF4MLvG28'
cat file | ./cloudsend.sh - 'https://cloud.mydomain.net/s/fLDzToZF4MLvG28' -r destFileName