The purpose of the Command Line Interface is to provide a simple way of using the Filerobot APIs programmatically.
An example of argument of command:
filename.png
Where "filename.png" is an argument.
An example of flag to a specific command can be:
filerobot upload filename.png
Where "--method" can be added as a flag.
sudo curl -L "https://github.com/scaleflex/filerobot-cli/releases/latest/download/filerobot-cli-darwin-x86_64" -o /usr/local/bin/filerobot && sudo chmod +x /usr/local/bin/filerobot
sudo curl -L "https://github.com/scaleflex/filerobot-cli/releases/latest/download/filerobot-cli-linux-x86_64.uu" -o /usr/local/bin/filerobot && sudo chmod +x /usr/local/bin/filerobot
If you want to add a different name of the command, you need to make an alias in your terminal profile, pointing to the executable file. For example:
MacOS:
- Go into ~/.zshrc file and copy this command:
alias frb="/usr/local/bin/filerobot"
Linux:
- Go into ~/.bashrc file and copy this command:
alias frb="/usr/local/bin/filerobot"
Verify that installation works with:
filerobot version
# Set up your credetentials
filerobot config --token=mytoken --key=mysupersecretkey
# Enter into a directory and upload a file
filerobot upload face.png
# List a specific folder from Filerobot
filerobot list /test
# Inspect a specific resource
filerobot inspect bb1ce06f-2677-581a-85e7-28c00ec50000
This section provides a general overview and example of the main commands.
You can check the list of all commands with:
filerobot --help
If you want to see a specific help message and instructions for a specific command, you can run:
filerobot upload --help
Config command is used to set token and key provided by Scaleflex, needed for using Filerobot CLI.
- token - token provided from Scaleflex
- key - key provided from Scaleflex
filerobot config --token=mytoken --key=mysupersecretkey
Upload command is used to upload file to the Filerobot store.
- filename - the name of the file that will be uploaded
- method - type of request POST or PUT (deprecated), if it's not set default is POST.
- folder - location where the file will be uploaded, if it's not set default is "/".
- postprocess - type of postprocess that will be included, if it's not set postprocess will not be added.
filerobot upload face.png
filerobot upload face.png --folder=/test
filerobot upload http://sample.li/face.png -m URL -f test_folder --info "key":"value" --info "some":"other" --tags tag1 --tags tag2
filerobot upload face.png -m POST --tags other_tag
filerobot upload face.png -m POST --product-reference 10 --product-position 0
List command is used to list all files and directories from the Filerobot store.
- Directory from where files and directories will be listed.
- limit - The number of files and directories that will be listed. The range of limit is between 0 and 4000 (default 100).
- offset - The number of offset (default 0).
Note: if you have directory or file that contains special characters, they need to be encoded.
Example folder named - Crispy Menu
must be passed like this - filerobot list Crispy%20Menu
filerobot list /test
filerobot list /docs --limit=150 --offset=0
filerobot list /docs --limit=500
Note
Inspect command is used to list information about given file by uuid
- file uuid
filerobot inspect bb1ce06f-2677-581a-85e7-28c00ec50000
Download command is used to download file by uuid or filepath
- uuid/filepath of file
- type - type of downloading(by filepath or uuid of file) default is uuid
filerobot download docs/boat.jpg --type=filepath
filerobot download bb1ce06f-2677-581a-85e7-28c00ec50000
- Download folder
filerobot download 907e26a8-4f62-58ca-8014-17aed514d84e
Move command is used to move file to new directory(if not exist, it will be created)
- uuid of file to be moved
- uuid/name of the new folder
- type - the type of the new folder where file will be located (uuid or folder name) (default is folder name)
filerobot move 5b12134e-70c6-5bd8-b49c-6264a08de5d7 /hello/world
Rename command is used to rename given file by uuid
- uuid of file
- the new file name
- name - new name of the file
filerobot rename bb1ce06f-2677-581a-85e7-28c00ec50000
filerobot rename bb1ce06f-2677-581a-85e7-28c00ec50000 --name=new_filename.jpg
Delete command is used to delete file by given uuid
- uuid of file
filerobot delete 22e8155e-4bdc-5476-9a0b-dbb09e750000
Print the version number of Filerobot CLI
filerobot --version
filerobot version
Product command gives possibility to operate with product ref and product position on files
filerobot product
filerobot product list
filerobot product list assets [product referrence]
filerobot product assign [uuid] -p 2 -r B012
You can find advanced methods that can be used in Filerobot CLI.
for i in *.jpg; do filerobot upload $i -f /cli/upload; done
dirs=(/test /); for i in ${dirs[*]}; do filerobot list $i --limit=100 --offset=0; done
- uuids.txt:
8bf63d53-f867-5b11-bcf9-7b4f13f50000
b6f4609b-6036-554f-b5e6-efa110f50001
3b6630bd-20a9-5813-8ece-b431bc250003
m26300bm-k872-57n1-8kl1-g831bc251234
file="uuids.txt"; while IFS=: read -r line; do filerobot inspect $line; done <"$file"