Skip to main content

Convert documents (pdf, docx, pptx, xlsx, ...) to Markdown via markitdown, recursively for a folder or directly for a single file.

Project description

convert-docs

Convert documents (pdf, docx, pptx, xlsx, and more) to Markdown via markitdown. Point it at a folder and it recursively converts everything, mirroring the structure into a destination folder; point it at a single file and it converts just that file.

Install

Requires Python 3.10+.

uv tool install convert-docs

Don't have uv? Install it first:

curl -LsSf https://astral.sh/uv/install.sh | sh   # macOS / Linux
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"   # Windows

Or skip uv entirely and use pip: pip install convert-docs

Usage

Run with no flags for an interactive prompt (asks for source, then destination):

convert-docs

Tip (macOS): select a file or folder in Finder and press Option+Command+C to copy its full path, then paste it into the prompt.

Pointing it at a single file converts just that file, writing the .md next to it by default. To use a different output name, append a comma and the new name at the source prompt: ~/Downloads/Report.pdf, quarterly-summary writes quarterly-summary.md.

Or pass flags to skip the prompts:

convert-docs -s ~/Documents/Reports -o ~/Documents/Reports_MD
convert-docs -e pdf,docx        # restrict which extensions get converted
convert-docs -f                 # force re-conversion, ignoring the up-to-date skip
convert-docs --last             # re-run with the same source/destination/extensions as last time
convert-docs -j 8                # convert 8 files in parallel instead of the default 4
convert-docs -n                  # dry run: show what would happen, write nothing
Flag Description
-s, --source Source file or directory to convert (skips the interactive prompt)
-o, --output Output directory (mirrors source structure), or for a single-file source, an output directory or file path (skips the interactive prompt)
-e, --ext Comma-separated extensions to convert
-f, --force Force re-conversion even if output .md already exists and is up to date
-l, --last Reuse the source, destination, and extensions from the last run (skips prompts; cannot be combined with -s/-o)
-j, --jobs Convert this many files in parallel using separate processes (default: min(4, cpu_count); use 1 for sequential)
-n, --dry-run Show what would be converted, skipped, or collide, without writing anything
--log-file Append this run's output to a file as well as stdout
--version Print the installed version and exit

Files with unsupported extensions are listed at the end instead of being silently skipped, and any conversion failures are reported with the underlying error. Common noise directories (.git, node_modules, .venv, __pycache__, etc.) are skipped automatically. If two source files would produce the same output path (e.g. report.docx and report.pdf both map to report.md), the first is converted and the rest are reported as collisions rather than silently overwritten.

Paths are highlighted in supported terminals; set NO_COLOR=1 to disable.

Re-running on new files

Every run saves its source/destination/extensions to ~/.config/convert-docs/last_run.json. Since conversion already skips files whose output is up to date, convert-docs --last is a cheap way to pick up newly added files in a folder you've converted before — run it manually whenever you want to sync, or wire it into a cron job / scheduled task on whatever interval suits you (just point it at the tool's full path, e.g. ~/.local/bin/convert-docs --last, since scheduled jobs don't load your shell profile).

Update

uv tool upgrade convert-docs

Development

uv run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

convert_docs-0.5.0.tar.gz (102.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

convert_docs-0.5.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file convert_docs-0.5.0.tar.gz.

File metadata

  • Download URL: convert_docs-0.5.0.tar.gz
  • Upload date:
  • Size: 102.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for convert_docs-0.5.0.tar.gz
Algorithm Hash digest
SHA256 58cd79b99f1d6c7a4eb4aacd4bd478df2e6d9a69c53dcee77e78bb9d21dfd6df
MD5 150df272d8489a8c7422a96b9bce889d
BLAKE2b-256 eab7f0ae51ee85c99db22a50e65bf4e40e41a1ea4719bedfa39d21ad59469f4a

See more details on using hashes here.

File details

Details for the file convert_docs-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: convert_docs-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for convert_docs-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c7b2fc6185c0d367fc9b9e1dc8aafad91758c36341bdfe13669765dc6b553af
MD5 98386c38299fa3b3f8de21669af6c4f5
BLAKE2b-256 a2132f8882b54ff30bce0e7c69089ea5ca72dc872872c16f1bc35ff7d558db81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page