ccremer / paperless-cli

CLI tool to interact with paperless-ngx remote API
GNU General Public License v3.0
7 stars 2 forks source link

Bulk-download #16

Closed ccremer closed 1 year ago

ccremer commented 1 year ago

Summary

As user I want to download all documents So that I can create a local offline copy of the documents for emergency access

Context

In case of a downtime of Paperless, all documents become unavailable as well. With a local offline copy, one can at least access the documents.

For this, we need to download all documents and optionally unzip them. In an ideal use case, this step is automated using cron or systemd timer and executed regularly.

Out of Scope

Further links

Acceptance criteria

Given a running Paperless instance with REST API access
When the CLI is invoked with subcommand `bulk-download LOCAL-FILENAME`
Then all documents are downloaded in `archive` format into `LOCAL-FILENAME.zip`
Given a running Paperless instance with REST API access
When the CLI is invoked with subcommand `bulk-download --unzip LOCAL-FILENAME`
Then all documents are downloaded and extracted into `LOCAL-FILENAME` dir
Given a running Paperless instance with REST API access
And file or dir `LOCAL-FILENAME` exists locally
When the CLI is invoked with subcommand `bulk-download LOCAL-FILENAME`
Then the download is aborted with an error message
Given a running Paperless instance with REST API access
And file or dir `LOCAL-FILENAME` exists locally
When the CLI is invoked with subcommand `bulk-download --overwrite LOCAL-FILENAME`
Then any previously existing file (or dir) called `LOCAL-FILENAME[.zip]` is removed
And all documents are downloaded into `LOCAL-FILENAME[.zip]` dir or zip file without error

Implementation Ideas