Skip to content

Latest commit

 

History

History
59 lines (38 loc) · 2.07 KB

File metadata and controls

59 lines (38 loc) · 2.07 KB

📄 CLI PDF Merger Utility

A robust, production-ready command-line tool for merging multiple PDF files from various directories into a single document.

While many online tools or basic scripts restrict you to a single input folder, this utility is built for maximum flexibility. It supports drag-and-drop functionality, parses complex file paths with spaces, and automatically extracts PDFs from entire directories.

This script serves as a foundational document-processing module for broader AI automation workflows and agentic systems (such as an Autonomous CFO).

✨ Features

  • Drag-and-Drop Support: Seamlessly drag files or folders directly into the terminal.
  • Smart Path Parsing: Utilizes Python's shlex module to safely handle file paths containing spaces and quotes.
  • Multi-Directory Merging: Feed it individual files from Drive C, an entire folder from Drive D, and it will handle them all in a single execution queue.
  • Modern Path Management: Built with pathlib for reliable, cross-platform OS file operations.
  • Graceful Error Handling: Catches permission errors, ignores non-PDF files, and features a clean keyboard interrupt exit.

🛠️ Tech Stack

  • Language: Python 3.x
  • Core Libraries: pypdf, pathlib, shlex, sys

🚀 Installation

  1. Clone the repository:

    git clone https://github.com/RZ-Logic/Python-Pdf-merger.git
    cd Python-pdf-merger
    
  2. Install the required dependencies:

    pip install pypdf
    

💻 Usage Run the script from your terminal:

python pdf_merger.py

Interactive Prompts:

Once running, the script accepts various inputs:

Single File: "C:\Docs\Invoice.pdf"

Entire Folder: "C:\Users\Downloads" (Automatically finds and sorts all PDFs inside)

Bulk Paste: Paste multiple paths at once separated by spaces.

Finish & Merge: Type done to combine all queued files into super.pdf.

Cancel: Type quit or exit to close the program without merging.



Part of a growing portfolio of Python automation tools and AI engineering projects.