text: const inquirer = require('inquirer');
  const fs = require('fs');
  
  const questionFolderPath = [
    {
      name: 'folderPath',
      type: 'input',
      message: 'Please insert the folder path:',
    }
  ]
  
  const questionSeparator = [
    {
      name: 'separator',
      type: 'input',
      message: 'Please insert the separator:'
    }
  ]
  
  function getAllFiles(folderPath, files = []) {
    fs.readdirSync(folderPath).forEach((arc) => {
      const arcPath = `${folderPath}/${arc}`;
      const isDir = fs.statSync(arcPath).isDirectory();
      if (isDir) {
        files = getAllFiles(arcPath, files);
      }
      else files.push(arcPath);
    });
    return files;
  }
  
  function changeFilesName(separator) {
    return (files) => {
      const newFiles = files.map((file) => file.split(separator)).map((file) => file[0].trim());
  
      console.log('\nNew file names:\n');
      newFiles.forEach((file) => console.log(file));
  
      files.forEach((file, index) => {
        fs.renameSync(file, newFiles[index]);
      })
    }
  }
  
  inquirer.prompt(questionFolderPath)
    .then((answer) => {
      console.log('Showing all files in the folder:\n');
      const files = getAllFiles(answer.folderPath);
      files.forEach((file) => console.log(file));
      console.log('\n');
  
      inquirer.prompt(questionSeparator)
      .then((answer) => {
        changeFilesName(answer.separator)(files);
        console.log('\nDone!!!');
      })
    });
  