const fs = require('fs');
const path = require('path');

// List of files you want to check and delete
const filesToDelete = [
    path.join(__dirname, '..', 'backupSchemes.json'),
    path.join(__dirname, '..', 'dirBackup.json'),
    path.join(__dirname, '..', 'dirShare.json'),
    path.join(__dirname, '..', 'usersInSystem.json'),
    path.join(__dirname, '..', 'loginData.json'),
    path.join(__dirname, '..', 'ipConfig.json')
];

filesToDelete.forEach(file => {
    fs.access(file, fs.constants.F_OK, (err) => {
        if (!err) {
            fs.unlink(file, err => {
                if (err) {
                    console.error(`Failed to delete ${file}: ${err}`);
                } else {
                    console.log(`${file} was deleted successfully.`);
                }
            });
        } else {
            console.log(`${file} does not exist.`);
        }
    });
});
