> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/cli/pdf-pagemaster/usage/batch.md).

# Batch PDF editing with command-line

Unlock the potential of PDF PageMaster for efficient file processing. Learn how to manage PDF files in folders and subfolders with ease. Optimize your workflow today! The Apryse CLI streamlines secure

If the user specifies a folder rather than a specific PDF document, then all the PDF files inside of the folder will be processed in the specified way.

`pagemaster <directory>|<password>,<page list 1>`

that is, each file will be processed as if \<directory> was the path of that file.

So, if directory pdf\_files contained files pdf1.pdf pdf2.pdf and pdf3.pdf

`pdf_files\|pass,1-10`

would be equivalent to

`pdf1.pdf|pass,1-10 pdf2.pdf|pass,1-10 pdf3.pdf|pass,1-10`

PDF PageMaster also allows processing of subfolders, using the '--subfolders' option.

If '--subfolders' option is specified, the 'remove', 'insert' and 'split' functions will create the required subfolder directory structure at the output path, if required. (A directory is required if it contains PDF files or contains folders that are required.) The 'merge' function will merge all PDF files found in the subfolders into one PDF at the output location.

## **Examples:**

The examples provided below are based on the following directory and file structure:

* directory pdf\_dir contains files p1.pdf p2.pdf and p3.pdf as well as directories

pdf\_First and pdf\_Second

* directory pdf\_First contains directories pdf\_Third and pdf\_Fourth
* directory pdf\_Second contains files p4.pdf and p5.pdf
* directory pdf\_Third contains file p6.pdf
* directory pdf\_Fourth contains only a text file ignored.txt

Merge files p1.pdf p2.pdf and p3.pdf and store the result in output.pdf:

`pagemaster -m pdf_dir/ -o output.pdf`

Merge files p1.pdf p2.pdf p3.pdf p4.pdf p5.pdf and p6.pdf and store the result in output.pdf:

`pagemaster -m --subfolders pdf_dir/ -o output.pdf`

Split files p1.pdf p2.pdf p3.pdf and store the resulting files p1\_1-5.pdf p2\_1-5.pdf and p3\_1-5.pdf in output/

`pagemaster -s pdf_dir/,1-5 -o output/`

Create the directories output/pdf\_First output/pdf\_Second and output/pdf\_First/pdf\_Third,

split the files p1.pdf p2.pdf p3.pdf p4.pdf p5.pdf and p6.pdf and store the resulting files

p1\_1-5.pdf p2\_1-5.pdf and p3\_1-5.pdf in output/, p4\_1-5.pdf and p5\_1-5.pdf

in output/pdf\_Second/ and p6\_1-5 in output/pdf\_First/pdf\_Third/ (pdf\_Fourth is not created since it is not required):

`pagemaster -s --subfolders pdf_dir/,1-5 -o output/`

Remove the first page of p1.pdf, p2.pdf and p3.pdf:

`pagemaster -r pdf_dir/,1`

Remove the first page of p1.pdf, p2.pdf, p3.pdf, p4.pdf, p5.pdf and p6.pdf:

`pagemaster -r --subfolders pdf_dir/,1`

Append insert.pdf to p1.pdf, p2.pdf and p3.pdf:

`pagemaster -i insert.pdf pdf\_dir/`

Append insert.pdf to p1.pdf, p2.pdf, p3.pdf, p4.pdf, p5.pdf and p6.pdf:

`pagemaster -i insert.pdf --subfolders pdf_dir/`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/cli/pdf-pagemaster/usage/batch.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
