Commands List¶
This document is the reference of the command-line interface (CLI) of Remofile, which allows one to start a server and perform various file operations in a sessionless fashion, from a terminal.
Commands are divided into client-related commands and server-related commands.
Client-related commands¶
The client-related commands consists of 6 commands, list, file, folder, upload, download and remove, and they all rely on a previously configured environment to locate the remote server and pass the authentication process. Therefore, a set of 4 environment variables must be set or the command-lines will stop prematurely.
REMOFILE_HOSTNAME
The address of the Remote server. Set it to ‘localhost’ if the server runs locally.
REMOFILE_PORT (optional)
The port to use when connecting to the server. By default, it uses 6768.
REMOFILE_TOKEN
The token with which the server was configured (a token was generated by the server if it wasn’t explicitly set).
REMOFILE_PUBLIC_KEY (optional)
The public key that goes in pair with the private key used on the server side. By default, a Remofile connection is not encrypted.
Example of configuring an environment on Unix-like OSes.
export REMOFILE_HOSTNAME=localhost
export REMOFILE_PORT=6768
export REMOFILE_TOKEN=something
export REMOFILE_PUBLIC_KEY=something
rmf list¶
List files in the remote directory.
This is a client-related command that lists files of a given directory located in the remote directory. This command is akin to the POSIX ls command found in Unix-like OSes.
It takes only one optional parameter which is the remote directory to list files for, and must be an absolute path of an existing directory. By default, it lists the root directory.
By default, it only displays file names and doesn’t list the directory recursively. If the -l flag is set, it also lists the file metadata (file or directory indicator, file size and last modification time), and if the -r flag is set, the sub-directories are listed as well.
Additionally, the –timeout flag allows you to adjust the number of milliseconds to wait before giving up on the server response.
rmf list [OPTIONS] [DIRECTORY]
Options
-
-a
,
--all
¶
Display additional file information.
-
-r
,
--recursive
¶
List directories and their contents recursively.
-
-t
,
--timeout
<timeout>
¶ Adjust the timeout value in milliseconds.
Arguments
-
DIRECTORY
¶
Optional argument
rmf file¶
Create a file in the remote directory.
This is a client-related command that creates an empty file in the a given directory located in the remote directory. This command is akin to the POSIX touch command found in Unix-like OSes.
It takes the name of the file and an optional remote directory (in which to create the file) in parameters. The directory parameter must be an absolute path of an existing directory. By default, it creates the file in the root directory.
If the file already exists in the given directory, the command fails unless the –update flag is set. Note that unlike the touch command, it doesn’t update the file timestamp.
Additionally, the –timeout flag allows you to adjust the number of milliseconds to wait before giving up on the server response.
rmf file [OPTIONS] NAME [DIRECTORY]
Options
-
-u
,
--update
¶
Ignore (and don’t fail) if files already exist.
-
-t
,
--timeout
<timeout>
¶ Adjust the timeout value in milliseconds.
Arguments
-
NAME
¶
Required argument
-
DIRECTORY
¶
Optional argument
rmf folder¶
Create a folder in the remote directory.
This is a client-related command that creates an empty folder in the a given directory located in the remote directory. This command is akin to the POSIX mkdir command found in Unix-like OSes.
It takes the name of the folder and an optional remote directory (in which to create the folder) in parameters. The directory parameter must be an absolute path of an existing directory. By default, it creates the folder in the root directory.
If the folder already exists in the given directory, the command fails unless the –update flag is set. Note that it leaves the existing directory unchanged.
Additionally, the –timeout flag allows you to adjust the number of milliseconds to wait before giving up on the server response.
rmf folder [OPTIONS] NAME [DIRECTORY]
Options
-
-u
,
--update
¶
Ignore (and don’t fail) if directories already exist.
-
-t
,
--timeout
<timeout>
¶ Adjust the timeout value in milliseconds.
Arguments
-
NAME
¶
Required argument
-
DIRECTORY
¶
Optional argument
rmf upload¶
Upload files to the remote directory.
This is a client-related command that uploads files to the remote directory. The source must be files or directories located on the local filesystem and the destination must be an existing directory located in the remote directory. Unlike the source, the destination must be an absolute path.
If source refers to one or more directories, the recursive flag must be set otherwise they’ll be skipped. The progress flag allows to display the progression of the transfer which is useful for large files.
Examples.
rmf upload -r -p src/my-file.txt src/my-directory/ /dst
Additionally, the –timeout flag allows you to adjust the number of milliseconds to wait before giving up on the server response.
rmf upload [OPTIONS] [SOURCE]... DESTINATION
Options
-
-r
,
--recursive
¶
Upload directories and their content recursively.
-
-p
,
--progress
¶
Display a progress indicator.
-
-t
,
--timeout
<timeout>
¶ Adjust the timeout value in milliseconds.
Arguments
-
SOURCE
¶
Optional argument(s)
-
DESTINATION
¶
Required argument
rmf download¶
Download files from the remote directory.
This is a client-related command that downloads files from the remote directory. The source must be files or directories located on the remote directory and the destination must be an existing directory located on the local filesystem. Unlike the destination, the source must be absolute paths.
If source refers to one or more directories, the recursive flag must be set otherwise they’ll be skipped. The progress flag allows to display the progression of the transfer which is useful for large files.
Examples.
rmf download -r -p /src/my-file.txt /src/my-directory/ dst/
Additionally, the –timeout flag allows you to adjust the number of milliseconds to wait before giving up on the server response.
rmf download [OPTIONS] [SOURCE]... DESTINATION
Options
-
-r
,
--recursive
¶
Download directories and their content recursively.
-
-p
,
--progress
¶
Display a progress indicator.
-
-t
,
--timeout
<timeout>
¶ Adjust the timeout value in milliseconds.
Arguments
-
SOURCE
¶
Optional argument(s)
-
DESTINATION
¶
Required argument
rmf remove¶
Remove files in the remote directory.
This is a client-related command that removes a file or a folder located in the remote directory. This command is akin to the POSIX rm command found in Unix-like OSes.
Rest of the description here.
rmf remove [OPTIONS] NAME [DIRECTORY]
Options
-
-t
,
--timeout
<timeout>
¶ Adjust the timeout value in milliseconds.
Arguments
-
NAME
¶
Required argument
-
DIRECTORY
¶
Optional argument
Server-related commands¶
Unlike the client-related commands, server-related commands don’t require to configure the environment. There are 3 main commands which are run, start and stop, and they allow you to start and stop a Remofile with various options. There are also two utility commands which are generate-token and generate-keys.
rmf run¶
Start a (non-daemonized) server.
This is a server-related command that start a non-daemonized server (not detached from the shell). The directory parameter is the root directory which will be served and therefore must be an existing directory. The server listens on port 6768 by default but it can be changed with the port parameter. If the token is not specified, it’s generated and printed out to the console before the server starts running.
Additionally, the file size limit and the chunk size range can be altered. The file size limit and minimum chunk size must be both be greater than 0, and maximum chunk size must be greater or equal to minimum chunk size.
rmf run [OPTIONS] DIRECTORY [PORT] [TOKEN]
Options
-
--file-size-limit
<file_size_limit>
¶ Foobar
-
--min-chunk-size
<min_chunk_size>
¶ Foobar
-
--max-chunk-size
<max_chunk_size>
¶ Foobar
Arguments
-
DIRECTORY
¶
Required argument
-
PORT
¶
Optional argument
-
TOKEN
¶
Optional argument
rmf start¶
Start a daemonized server.
This is a server-related command that start a daemonized server (detached from the shell). Unlike the run command, it accepts the –pidfile flag which tells the pidfile location. By default, the pidfile is created in the current working directory and named ‘daemon.pid’.
Refer to the run command for more information.
rmf start [OPTIONS] DIRECTORY [PORT] [TOKEN]
Options
-
--pidfile
<pidfile>
¶ Foobar
-
--file-size-limit
<file_size_limit>
¶ Foobar
-
--min-chunk-size
<min_chunk_size>
¶ Foobar
-
--max-chunk-size
<max_chunk_size>
¶ Foobar
Arguments
-
DIRECTORY
¶
Required argument
-
PORT
¶
Optional argument
-
TOKEN
¶
Optional argument
rmf stop¶
Stop a daemonized server.
This is a server-related command that stop a daemonized server from its pidfile. By default, it expects the pidfile in the current working directory with the name ‘daemon.pid’ but it can be altered with the –pidfile flag.
rmf stop [OPTIONS]
Options
-
--pidfile
<pidfile>
¶ Foobar
rmf generate-token¶
Generate a token.
This is an utility command that generates a valid token needed to configure both the client and the server.
Note that by default, the server will generate a token if none was explicitly set.
rmf generate-token [OPTIONS]
rmf generate-keys¶
Generate a pair of keys.
This is an utility command that generates a valid pair of keys to encrypt communication with clients.
The first key is a public key that must be shared across clients
connecting to the Remofile server and the second key is the private
key that must be kept secret. Both Client
and
Server
instances must be configured with their
respective keys.
rmf generate-keys [OPTIONS]