Add an export-files script

This commit is contained in:
Eike Kettner
2020-11-29 01:30:15 +01:00
parent 45e4035e07
commit 0dafe57034
3 changed files with 227 additions and 8 deletions

View File

@ -82,14 +82,11 @@ documentation, too.
In order to move to a different tool, it is necessary to get the data
out of Docspell in a machine readable/automatic way. Currently, there
is no *easy way* for this. However, it is possible to get to all data
with some scripting effort. Everything can be queried using a
[HTTP/REST api](@/docs/api/_index.md) and so you can write a
script/program that, for example, queries all items and downloads the
files (something like this might be provided soon, for now there are
starting points in the `/tools` folder). It is planned to provide a
more convenient way to export the data into the file system. But there
is no ETA for this.
is no *easy way* for this. However, everything can be queried using a
[HTTP/REST api](@/docs/api/_index.md) and so it is possible to get to
all data with some scripting effort. There exists a script in the
`tools/` folder that at least can go and download all files that have
been uploaded to docspell.
My recommendation is to run periodic database backups and also store
the binaries/docker images. This lets you re-create the current state

View File

@ -0,0 +1,33 @@
+++
title = "Export Files"
description = "Downloads all files from docspell."
weight = 65
+++
# export-files.sh
This script can be used to download all files from docspell that have
been uploaded before.
# Requirements
It is a bash script that additionally needs
[curl](https://curl.haxx.se/) and
[jq](https://stedolan.github.io/jq/).
# Usage
```
./export-files.sh <docspell-base-url> <target-directory>
```
For example, if docspell is at `http://localhost:7880`:
```
./export-files.sh http://localhost:7880 /tmp/ds-downloads
```
The script asks for your account name and password. It then logs in
and goes through all items downloading the metadata as json and the
attachments. It will fetch the original files (not the converted
ones).