Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Duplicate content with JS
const fs = require('fs-extra');
const glob = require('glob');
const promisify = require('util.promisify');
const globAsync = promisify(glob);
const getAllFiles = async () => {
const allFiles = await globAsync('../content/**/*.de.md');
for (const file of allFiles) {
await fs.copy(file, file.replace('.de.md','.test.md'));
}
}
(async () => {
await getAllFiles();
})();
{
"name": "duplciate-content",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"fs-extra": "^9.0.1",
"glob": "^7.1.6"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment