manual for move-article
User Guide: The
move-article Tool
This guide explains how to use the move-article
command-line tool to safely move a post and all its referenced images
from one section of the blog to another.
Purpose
When writing for the blog, you might start a post in one section
(e.g., blog) and later decide it belongs in another (e.g.,
articles). Moving the Markdown file is easy, but finding
and moving all the images linked within that post is tedious and
error-prone.
The move-article tool automates this entire process. It:
1. Reads the source Markdown file. 2. Finds all linked images within it.
3. Moves the post file to the new section. 4. Moves all the associated
images to the new section’s images directory. 5. Creates
the destination images directory if it doesn’t already
exist.
This ensures that a post’s content and its images always stay together, preventing broken image links.
Blog Directory Structure
The tool assumes your blog project follows a specific structure. The
root of your project should contain a sections.ini file and
a source directory (commonly named src/). Inside the source
directory, each section has its own folder containing two
subdirectories: posts and images.
/home/user/my-blog/
├── sections.ini
├── templates/
├── src/
│ ├── articles/
│ │ ├── images/
│ │ │ └── another-image.jpg
│ │ └── posts/
│ │ └── another-article.md
│ │
│ ├── blog/
│ │ ├── images/
│ │ │ ├── image1.png
│ │ │ └── image2.gif
│ │ └── posts/
│ │ └── example-article.md
│ │
│ └── another-section/
│ ├── images/
│ └── posts/
│
└── dist/
└── ... (final website output)
How to Use
The tool is run from the command line and requires two arguments:
--source and --destination.
Command-Line Switches
--source=<path/to/post.md>- Required. This is the full path to the Markdown post file you want to move.
--destination=<path/to/new/posts/dir>- Required. This is the full path to
the
postsdirectory of the section where you want to move the article.
- Required. This is the full path to
the
Example
Imagine you want to move example-article.md from the
blog section to the articles section.
Based on the directory structure above, you would run the following command in your terminal:
./move-article \
--source=/home/user/my-blog/src/blog/posts/example-article.md \
--destination=/home/user/my-blog/src/articles/postsWhat Happens
After running the command, the tool will: 1. Move the
post: * From:
/home/user/my-blog/src/blog/posts/example-article.md * To:
/home/user/my-blog/src/articles/posts/example-article.md 2.
Move its images (e.g., image1.png and
image2.gif): * From:
/home/user/my-blog/src/blog/images/ * To:
/home/user/my-blog/src/articles/images/
The tool will print a log of its actions, confirming which files were moved.
© 2026 rcanzlovar.com | About | Contact | Privacy Policy |
![]()