You can use this to delete multiple files (for Linux Env ββES6 syntax)
import {execSync} from "child_process"; ... ... const files = ['file1.js', 'file2.jpg', 'file3.css']; // just example path const rootDir = '/var/www/files/'; if (files.length > 0) execSync('rm -f' + files.map(o => rootDir + o.replace(/(\s+)/g, '\\$1')).join(' '));
ignore rm -f if files are missing, and replace with spaces if file names contain it,
source share