Browse the documentation
Home
Applications
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
| Option | Effect |
|---|---|
--json | JSON output, for scripts |
--no-autostart | do not start the service if it is absent |
--version | version 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 accountsThe commands
Status and log
| Command | Effect |
|---|---|
status | overall status and status of each account, with the time of the last sync and, for a new account, what to do next |
accounts | details 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
| Command | Effect |
|---|---|
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 ID | renews 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
| Command | Effect |
|---|---|
sync [ID] | starts a cycle now, on one account or on all |
pause ID, resume ID | pauses, resumes |
confirm ID accept or confirm ID refuse | answers a request to confirm deletions; refusing pauses the account |
rebuild ID | rebuilds the local index without transferring unchanged files, then prints the number of items recognised |
Folders and first sync
| Command | Effect |
|---|---|
folders ID [--depth N] | the tree of cloud folders, with their identifier, their selection and their size |
estimate ID | what 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 ID | for 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 --confirmCloud trash
| Command | Effect |
|---|---|
trash ID | number 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
| Command | Effect |
|---|---|
config | all general settings |
config KEY | the value of one setting |
config KEY VALUE | changes a setting; the service checks bounds and allowed values |
quit | stops 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 500Link files
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.