text: const fs = require("fs/promises");
  const path = require("path");
  const readdir = fs.readdir;
  const copyFile = fs.copyFile;
  const access = fs.access;
  const currentPath = path.join(__dirname, "files/");
  const copyPath = path.join(__dirname, "files-copy/");
  async function getNameofFiles() {
    const fileNames = await readdir(currentPath);
    return fileNames;
  }
  
  async function copy() {
    try {
      await access(copyPath);
      const fileNames = await getNameofFiles();
      await fs.rm(copyPath, { recursive: true });
      await fs.mkdir(copyPath, {
        recursive: true
      });
      fileNames.forEach((item) =>
        copyFile(`${currentPath}${item}`, `${copyPath}${item}`)
      );
    } catch (err) {
      await fs.mkdir(copyPath, {
        recursive: true
      });
      const fileNames = await getNameofFiles();
      fileNames.forEach((item) =>
        copyFile(`${currentPath}${item}`, `${copyPath}${item}`)
      );
    }
  }
  copy();
  