Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Be sure the scratch directory exists before using it as temporary directory

Trenton Hc422a081bf51
diff --git a/src/documents/management/commands/document_exporter.py b/src/documents/management/commands/document_exporter.py
index fdea8aff6..427cd4ef2 100644
--- a/src/documents/management/commands/document_exporter.py
+++ b/src/documents/management/commands/document_exporter.py
@@ -156,11 +156,13 @@ class Command(BaseCommand):
zip_export: bool = options["zip"]
# If zipping, save the original target for later and
- # get a temporary directory for the target
+ # get a temporary directory for the target instead
temp_dir = None
original_target = None
if zip_export:
original_target = self.target
+
+ os.makedirs(settings.SCRATCH_DIR, exist_ok=True)
temp_dir = tempfile.TemporaryDirectory(
dir=settings.SCRATCH_DIR,
prefix="paperless-export",