Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

111
Vistas
fs.copyFileSync doesn't do anything

I'm using Node.js to copy a few files for one of my packages. My OS is Windows 10 Pro. When I run the JS file (tried in cmd, powershell and cmd with admin) absolutely nothing happens. No error, no copy. Here's the code:

#! /usr/bin/env node
let fs = require("fs");
let path = require("path");

let rootPath = path.join(__dirname, "..");

let root = fs.readdirSync(rootPath);

let exclude = [
    ".git",
    ".gitignore",
    ".prettierrc",
    "bin",
    "node_modules",
    "dist",
];

root = root.filter((item) => exclude.indexOf(item) === -1);

let rootFiles = root.filter((item) =>
    fs.statSync(path.join(__dirname, "..", item)).isFile()
);

let rootFolders = root.filter((item) =>
    fs.statSync(path.join(__dirname, "..", item)).isDirectory()
);

for (let file of rootFiles) {
    let filePath = path.join(rootPath, file);
    let destinationPath = path.join(process.cwd(), file);

    if (!fs.existsSync(filePath)) {
        fs.copyFileSync(filePath, destinationPath);
    }
}

process.exit(0);
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda