mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Allow the user the specifiy the zip file name (#4189)
This commit is contained in:
parent
5ee9ad3e4f
commit
ec9ebd3026
@ -251,14 +251,15 @@ is not a TTY" errors. For example:
|
||||
document_exporter target [-c] [-d] [-f] [-na] [-nt] [-p] [-sm] [-z]
|
||||
|
||||
optional arguments:
|
||||
-c, --compare-checksums
|
||||
-d, --delete
|
||||
-f, --use-filename-format
|
||||
-c, --compare-checksums
|
||||
-d, --delete
|
||||
-f, --use-filename-format
|
||||
-na, --no-archive
|
||||
-nt, --no-thumbnail
|
||||
-p, --use-folder-prefix
|
||||
-p, --use-folder-prefix
|
||||
-sm, --split-manifest
|
||||
-z --zip
|
||||
-z, --zip
|
||||
-zn, --zip-name
|
||||
```
|
||||
|
||||
`target` is a folder to which the data gets written. This includes
|
||||
@ -314,7 +315,8 @@ manifest.json will still contain application wide information (e.g. tags, corres
|
||||
documenttype, etc)
|
||||
|
||||
If `-z` or `--zip` is provided, the export will be a zip file
|
||||
in the target directory, named according to the current date.
|
||||
in the target directory, named according to the current local date or the
|
||||
value set in `-zn` or `--zip-name`.
|
||||
|
||||
!!! warning
|
||||
|
||||
|
@ -125,6 +125,13 @@ class Command(BaseCommand):
|
||||
help="Export the documents to a zip file in the given directory",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-zn",
|
||||
"--zip-name",
|
||||
default=f"export-{timezone.localdate().isoformat()}",
|
||||
help="Sets the export zip file name",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--no-progress-bar",
|
||||
default=False,
|
||||
@ -147,13 +154,13 @@ class Command(BaseCommand):
|
||||
|
||||
def handle(self, *args, **options):
|
||||
self.target = Path(options["target"]).resolve()
|
||||
self.split_manifest = options["split_manifest"]
|
||||
self.compare_checksums = options["compare_checksums"]
|
||||
self.use_filename_format = options["use_filename_format"]
|
||||
self.use_folder_prefix = options["use_folder_prefix"]
|
||||
self.delete = options["delete"]
|
||||
self.no_archive = options["no_archive"]
|
||||
self.no_thumbnail = options["no_thumbnail"]
|
||||
self.split_manifest: bool = options["split_manifest"]
|
||||
self.compare_checksums: bool = options["compare_checksums"]
|
||||
self.use_filename_format: bool = options["use_filename_format"]
|
||||
self.use_folder_prefix: bool = options["use_folder_prefix"]
|
||||
self.delete: bool = options["delete"]
|
||||
self.no_archive: bool = options["no_archive"]
|
||||
self.no_thumbnail: bool = options["no_thumbnail"]
|
||||
zip_export: bool = options["zip"]
|
||||
|
||||
# If zipping, save the original target for later and
|
||||
@ -189,7 +196,7 @@ class Command(BaseCommand):
|
||||
shutil.make_archive(
|
||||
os.path.join(
|
||||
original_target,
|
||||
f"export-{timezone.localdate().isoformat()}",
|
||||
options["zip_name"],
|
||||
),
|
||||
format="zip",
|
||||
root_dir=temp_dir.name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user