`docker-compose exec -T webserver document_exporter ../export`
```
-document_exporter target [-c] [-f] [-d] [-na] [-nt]
+document_exporter target [-c] [-f] [-p] [-d] [-na] [-nt]
optional arguments:
-c, --compare-checksums
-f, --use-filename-format
+-p, --use-filename-prefix
-d, --delete
-na, --no-archive
-nt, --no-thumbnail
paperless to use `PAPERLESS_FILENAME_FORMAT` for exported filenames
instead, specify `--use-filename-format`.
+If `-p` or `--use-filename-format` is provided, Files will be exported
+in dedicated folders according to their nature: `archive`, `originals`
+or `thumbnails`
+
!!! warning
If exporting with the file name format, there may be errors due to
"export directory, if configured.",
)
+ parser.add_argument(
+ "-p",
+ "--use-filename-prefix",
+ default=False,
+ action="store_true",
+ help="Export files in dedicated folders according to their nature: "
+ "archive, originals or thumbnails",
+ )
+
parser.add_argument(
"-d",
"--delete",
action="store_true",
help="Avoid exporting thumbnail files",
)
+
parser.add_argument(
"--no-progress-bar",
default=False,
self.exported_files: List[Path] = []
self.compare_checksums = False
self.use_filename_format = False
+ self.use_filename_prefix = False
self.delete = False
self.no_archive = False
self.no_thumbnail = False
self.target = Path(options["target"]).resolve()
self.compare_checksums = options["compare_checksums"]
self.use_filename_format = options["use_filename_format"]
+ self.use_filename_prefix = options["use_filename_prefix"]
self.delete = options["delete"]
self.no_archive = options["no_archive"]
self.no_thumbnail = options["no_thumbnail"]
# 3.3. write filenames into manifest
original_name = base_name
+ if self.use_filename_prefix:
+ original_name = ("originals" / Path(original_name)).resolve()
original_target = (self.target / Path(original_name)).resolve()
document_dict[EXPORTER_FILE_NAME] = original_name
if not self.no_thumbnail:
thumbnail_name = base_name + "-thumbnail.webp"
+ if self.use_filename_prefix:
+ thumbnail_name = ("thumbnails" / Path(thumbnail_name)).resolve()
thumbnail_target = (self.target / Path(thumbnail_name)).resolve()
document_dict[EXPORTER_THUMBNAIL_NAME] = thumbnail_name
else:
if not self.no_archive and document.has_archive_version:
archive_name = base_name + "-archive.pdf"
+ if self.use_filename_prefix:
+ archive_name = ("archive" / Path(archive_name)).resolve()
archive_target = (self.target / Path(archive_name)).resolve()
document_dict[EXPORTER_ARCHIVE_NAME] = archive_name
else: