MCPcopy Create free account
hub / github.com/ConardLi/easy-llm-cli / copyFilesRecursive

Function copyFilesRecursive

scripts/copy_files.js:31–48  ·  view source on GitHub ↗
(source, target)

Source from the content-addressed store, hash-verified

29const extensionsToCopy = ['.md', '.json', '.sb'];
30
31function copyFilesRecursive(source, target) {
32 if (!fs.existsSync(target)) {
33 fs.mkdirSync(target, { recursive: true });
34 }
35
36 const items = fs.readdirSync(source, { withFileTypes: true });
37
38 for (const item of items) {
39 const sourcePath = path.join(source, item.name);
40 const targetPath = path.join(target, item.name);
41
42 if (item.isDirectory()) {
43 copyFilesRecursive(sourcePath, targetPath);
44 } else if (extensionsToCopy.includes(path.extname(item.name))) {
45 fs.copyFileSync(sourcePath, targetPath);
46 }
47 }
48}
49
50if (!fs.existsSync(sourceDir)) {
51 console.error(`Source directory ${sourceDir} not found.`);

Callers 1

copy_files.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected