The current path of the file to move
The target path (can be a directory)
Configuration options for the move operation
Promise resolving to detailed operation results
const fileOps = new FileOperations();
// Simple move
await fileOps.moveFile('docs/old.md', 'docs/new.md');
// Move to directory (filename preserved)
await fileOps.moveFile('guide.md', './docs/');
// Move a linked image, updating any markdown files that reference it
await fileOps.moveFile('image.png', 'assets/image.png');
// Dry run with verbose output
const result = await fileOps.moveFile('api.md', 'reference/api.md', {
dryRun: true,
verbose: true
});
Move multiple files in a single operation
Validate the integrity of links after an operation
Move a file (markdown, or a non-markdown asset such as an image) and update all links that reference it.
This method performs an intelligent move operation that:
A non-markdown source (an image, for example) is moved as-is; only the markdown files that link to it are updated, since it has no markdown links of its own to refactor.