Skip to content
HTKapp
Browse the documentation

Command line: driving the service from a terminal

Everything the window does can also be driven with htkcloudsync-cli, for scripts, remote sessions and computers without a display. The tool talks to the same service as the window and starts that service if it is not running yet. Its messages are in French.

General options

OptionEffect
--jsonJSON output, for scripts
--no-autostartdo not start the service if it is absent
--versionversion of the tool

Exit code: 0 on success, 1 if the service refused the command (the reason is printed), 2 if the service cannot be reached.

Identifying an account

Most commands take an account identifier. status and accounts print it, next to the address:

htkcloudsync-cli status
htkcloudsync-cli accounts

The commands

Status and log

CommandEffect
statusoverall status and status of each account, with the time of the last sync and, for a new account, what to do next
accountsdetails of the accounts
activity [ID] [-n N]the latest events of the log (30 by default)
activity --export FILE [--since DATE] [--until DATE] [--level LEVEL] [--format csv|json]exports the log; the format follows the file extension, dates are written YYYY-MM-DD or YYYY-MM-DDTHH:MM, and --level (info, warning, error) can be repeated

Accounts

CommandEffect
add-account [--root FOLDER] [--timeout SECONDS]adds a Google Drive account: the address to open in the browser is printed, and the command waits for your authorisation (ten minutes by default)
reconnect IDrenews the sign-in of an account, the same way
remove-account ID [--delete-local]disconnects the account; with the option, also moves the local folder to the trash

Syncing

CommandEffect
sync [ID]starts a cycle now, on one account or on all
pause ID, resume IDpauses, resumes
confirm ID accept or confirm ID refuseanswers a request to confirm deletions; refusing pauses the account
rebuild IDrebuilds the local index without transferring unchanged files, then prints the number of items recognised

Folders and first sync

CommandEffect
folders ID [--depth N]the tree of cloud folders, with their identifier, their selection and their size
estimate IDwhat the selection would download, against the free space of the disk and the space of the Drive
exclude ID FOLDER… [--include] [--yes]excludes folders (or re-includes them with --include); excluding sends the local copies to the trash, hence a question, which --yes skips
selection IDfor a new account: prints the estimate and what to do next
selection ID --confirm [--force]starts the first sync; refused if the selection does not fit on the disk, unless --force

For a new account, the first sync goes like this:

htkcloudsync-cli folders gdrive-123456abcdef
htkcloudsync-cli exclude gdrive-123456abcdef ID_OF_THE_ARCHIVES_FOLDER
htkcloudsync-cli estimate gdrive-123456abcdef
htkcloudsync-cli selection gdrive-123456abcdef --confirm

Cloud trash

CommandEffect
trash IDnumber of items and size of the Google Drive trash
trash ID --empty [--yes]empties it permanently, after a question recalling what will disappear; refused if the trash changed between the reading and the emptying

Settings and service

CommandEffect
configall general settings
config KEYthe value of one setting
config KEY VALUEchanges a setting; the service checks bounds and allowed values
quitstops the service

For instance, to turn off starting with the session and to cap uploads at 500 KB/s:

htkcloudsync-cli config autostart false
htkcloudsync-cli config upload_limit_kbps 500

The handler that opens Google documents can also be called from a terminal. With --print, it prints the address it would open without launching the browser:

htkcloudsync-open-link --print "Label brief 2026.gdoc"

Note: the command line applies the same guards as the window. Excluding folders or emptying the trash asks for confirmation; in a script, pass --yes knowingly.