===================
Command Line Client
===================

The F7cloud Client packages contain a command line client, ``f7cloudcmd``, that can 
be used to synchronize F7cloud files to client machines.

``f7cloudcmd`` performs a single *sync run* and then exits the synchronization 
process. In this manner, ``f7cloudcmd`` processes the differences between 
client and server directories and propagates the files to bring both 
repositories to the same state. Contrary to the GUI-based client, 
``f7cloudcmd`` does not repeat synchronizations on its own. It also does not 
monitor for file system changes.


Install ``f7cloudcmd``
~~~~~~~~~~~~~~~~~~~~~~~~

CentOS

::

    $ sudo yum -y install epel-release
    $ sudo yum -y install f7cloud-client

Ubuntu

::

    $ sudo add-apt-repository ppa:f7cloud-devs/client
    $ sudo apt update
    $ sudo apt install f7cloud-client

Debian

::

    $ sudo apt install f7cloud-desktop-cmd


Refer to the link

- https://f7cloud.com/install/#install-clients
- https://launchpad.net/~f7cloud-devs/+archive/ubuntu/client
- https://pkgs.alpinelinux.org/packages?name=f7cloud-client
- https://help.f7cloud.com/t/linux-packages-status/10216


To invoke ``f7cloudcmd``, you must provide the local and the remote repository 
URL using the following command::

  f7cloudcmd [OPTIONS...] sourcedir f7cloudurl

where ``sourcedir`` is the local directory and ``f7cloudurl`` is
the server URL.

Other command line switches supported by ``f7cloudcmd`` include the following:

``--path``
       Overrides default remote root folder to a specific subfolder on the server(e.g.: /Documents would sync the Documents subfolder on the server)

``--user``, ``-u`` `<user>`
       Use ``user`` as the login name.

``--password``, ``-p`` `<password>`
       Use `password` as the password.

``-n``
       Use`netrc(5)` for login.

``--non-interactive``
       Do not prompt for questions and tries to read $NC_USER and $NC_PASSWORD from the environment.

``--silent``, ``--s``
       Inhibits verbose log output.

``--trust``
       Trust any SSL certificate, including invalid ones.

``--httpproxy``  `http://[user@pass:]<server>:<port>`
      Uses `server` as HTTP proxy.

``--exclude`` `<file>`
      Exclude list file

``--unsyncedfolders`` `<file>`
      File containing the list of unsynced folders (selective sync)

``--max-sync-retries`` `<n>`
      Retries maximum n times (defaults to 3)

``-h``
      Sync hidden files,do not ignore them


Credential Handling
~~~~~~~~~~~~~~~~~~~

``f7cloudcmd`` requires the user to specify the username and password using the standard URL pattern, e.g., 

::

  $ f7cloudcmd /home/user/my_sync_folder https://carla:secret@server/f7cloud

To synchronize the F7cloud directory ``Music`` to the local directory
``media/music``, through a proxy listening on port ``8080``, and on a gateway
machine using IP address ``192.168.178.1``, the command line would be::

  $ f7cloudcmd --httpproxy http://192.168.178.1:8080 --path /Music \
                $HOME/media/music \
                https://server/f7cloud

``f7cloudcmd`` will prompt for the user name and password, unless they have
been specified on the command line or ``-n`` has been passed.

Exclude List
~~~~~~~~~~~~

``f7cloudcmd`` requires access to an exclude list file. It must either be
installed along with ``f7cloudcmd`` and thus be available in a system location,
be placed next to the binary as ``sync-exclude.lst`` or be explicitly specified
with the ``--exclude`` switch.

The required file content is one exclude item per line where wildcards are allowed, e.g.: 
::

    ~*.tmp
    ._*
    ]Thumbs.db
    ]photothumb.db
    System Volume Information

Example
~~~~~~~~~~~~

- Synchronize a local directory to the specified directory of the f7cloud server

::

    $ f7cloudcmd --path /<Directory_that_has_been_created> /home/user/<my_sync_folder> \
    https://<username>:<secret>@<server_address>
