MCPcopy Create free account
hub / github.com/Microck/opencode-studio / copyDirContents

Function copyDirContents

server/index.js:2116–2140  ·  view source on GitHub ↗
(src, dest)

Source from the content-addressed store, hash-verified

2114const RESERVED_WIN_NAMES = ['con', 'prn', 'aux', 'nul', 'com0', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt0', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9'];
2115
2116function copyDirContents(src, dest) {
2117 if (!fs.existsSync(src)) return;
2118 fs.mkdirSync(dest, { recursive: true });
2119 const SKIP_DIRS = ['node_modules', '.git', '.next', 'cache'];
2120 const SKIP_EXT = ['.log', '.tmp', '.db', '.sqlite', '.cache', '.pack', '.idx'];
2121
2122 for (const name of fs.readdirSync(src)) {
2123 if (RESERVED_WIN_NAMES.includes(name.toLowerCase())) {
2124 console.warn(`Skipping reserved Windows filename: ${name}`);
2125 continue;
2126 }
2127
2128 const srcPath = path.join(src, name);
2129 const destPath = path.join(dest, name);
2130 const stat = fs.statSync(srcPath);
2131
2132 if (stat.isDirectory()) {
2133 if (SKIP_DIRS.includes(name)) continue;
2134 copyDirContents(srcPath, destPath);
2135 } else {
2136 if (SKIP_EXT.some(ext => name.endsWith(ext))) continue;
2137 fs.copyFileSync(srcPath, destPath);
2138 }
2139 }
2140}
2141
2142function execPromise(cmd, opts = {}) {
2143 return new Promise((resolve, reject) => {

Callers 2

performGitHubBackupFunction · 0.85
index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected