Add option to prevent overwriting input files
pdfunite with a list of files, and the last file already exists it will overwrite it without asking, effectively deleting information for the user.
I suggest adding a
-f | --force option to prevent accidental deletion of user information.
When no destination file is specified (i.e. all specified files exist and so they are considered source files):
$ ls file1.pdf file2.pdf $ pdfunite file1.pdf file2.pdf Error: no output file specified
When the last specified file does not exist it is considered a destination file:
$ ls file1.pdf file2.pdf $ pdfunite file1.pdf file2.pdf file3.pdf $ ls file1.pdf file2.pdf file3.pdf
When we want to force the last file to be considered as a destination file, even though it already exists:
$ ls -l -rw-r--r-- 1 user group 253990 Feb 20 12:34 file1.pdf -rw-r--r-- 1 user group 803223 Feb 20 12:33 file2.pdf $ pdfunite -f file1.pdf file2.pdf $ ls -l -rw-r--r-- 1 user group 253990 Feb 20 12:34 file1.pdf -rw-r--r-- 1 user group 254050 Feb 20 12:34 file2.pdf