It should be noted file-share does supports uploading files too, which you can do from the web page at the "File Sharing URL" for a specific /ip/cloud/file-share. I check the "Allow Uploads" box and it works.
It was not clear how to do this with curl. Inspecting the browser, it's using standard POST form encoding using multipart/form-data. So in curl from a desktop you can copy a file name "example.txt" using the following command:
Code: Select all
curl -v https://0fak3serial123.routingthecloud.net/s/sEcRetKEYfromRtROS/ -F "file=@example.txt"
If you want to copy a set of files, I wrote a quick-and-dirty bourne shell (ash, bash, zsh) function, copy2router(). It will take 1 or files to copy from shell prompt and use "curl" with a /ip/cloud/file-share. Importantly the shell will expect the wildcard like *.txt or *.* or *, all those should work. It use an environment variable ICRS_URL="https://...." which must be set to use the function, and the URL should be without any trailing slash, to match shown in RouterOS (the function below will ADD the / for you - so it's still needed want envvar to match what RouterOS showed).
Now I'm not sure what happen when files are "big",/slow connections, etc... but the curl command to copy MULTIPLE FILES to try is here:
Code: Select all
ICFS_URL="https://0fak3serial123.routingthecloud.net/s/sEcRetKEYfromRtROS"
copy2router() {
local files=("$@")
if [[ -z "$ICFS_URL" ]]; then
echo "ICFS_URL must be to the 'File Share URL' from a RouterOS /ip/cloud/file-share"
echo " The environment variable must be in you shell $0"
echo " export ICFS_URL=\"https://sn12345677.routingthecloud.new/s/key123456\""
fi
local form_data=()
for file in "${files[@]}"; do
form_data+=("-F" "file=@$file")
done
curl "$ICFS_URL/" "${form_data[@]}"
}
![Wink ;)](./images/smilies/icon_wink.gif)