Replies: 1 comment 1 reply
-
|
markitdown does not have a built-in batch mode, but it is straightforward to loop over files in Python: from pathlib import Path
from markitdown import MarkItDown
md = MarkItDown()
input_dir = Path("input")
output_dir = Path("output")
output_dir.mkdir(exist_ok=True)
for path in input_dir.glob("*"):
try:
result = md.convert(str(path))
out_path = output_dir / path.with_suffix(".md").name
out_path.write_text(result.text_content, encoding="utf-8")
print(f"Converted: {path.name}")
except Exception as e:
print(f"Skipped {path.name}: {e}")You can change the glob pattern to or to target specific types. The same instance is reused across all files so there is no startup overhead per file. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a requirement to convert bulk docx and pdf files to .md , will this tool support this. If so can you please help me with how can we achieve that requirement.
Beta Was this translation helpful? Give feedback.
All reactions