Files
2026-07-13 12:38:36 +08:00

29 lines
643 B
JavaScript

//@ts-check
const { mkdirSync, copySync } = require('fs-extra');
const glob = require('tinyglobby');
const { join, basename } = require('path');
const p = process.argv[2];
const args = process.argv.slice(2);
const dest = args[args.length - 1];
const from = args.slice(0, args.length - 1);
try {
mkdirSync(dest, {
recursive: true,
});
} catch {}
for (const f of from) {
const matchingFiles = glob.globSync(f, {
cwd: process.cwd(),
onlyDirectories: true,
});
for (const file of matchingFiles) {
const destFile = join(dest, basename(file));
console.log(file, '=>', destFile);
copySync(file, destFile);
}
}