Created
November 4, 2020 15:53
-
-
Save maximilian-lindsey/0843c24f3520d00ecd363e3e8377a2f7 to your computer and use it in GitHub Desktop.
Duplicate content with JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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