text: const fs = require('fs');
  const path = require('path');
  const { readdir } = require('fs/promises');
  
  fs.mkdir(path.join(__dirname, 'files-copy'), { recursive: true }, (err) => {
    if (err) throw err;
  });
  
  async function read() {
    const files = await readdir(path.join(__dirname, 'files'), {withFileTypes: true});
    const filesCopy = await readdir(path.join(__dirname, 'files-copy'), {withFileTypes: true});
  
    for (let item of filesCopy) {
      fs.unlink(path.join(__dirname, 'files-copy', item.name), (err) => {
        if (err) throw err;
      });
    }
  
    for (let item of files) {
      fs.copyFile(path.join(__dirname, 'files', item.name), path.join(__dirname, 'files-copy', item.name), (err) => {
        if (err) throw err;
      });
    }
  }
  read();