Mass Copy Files

PHP Bulk Copy File

2024-10-26 19:52:07 - Coderja

<?php
$sourceFile = '/home/u981617792/domains/domain1.com/public_html/update.php';
$domainsDir = '/home/u981617792/domains/';

// Ambil semua direktori domain
$domainDirs = glob($domainsDir . '*/');

foreach ($domainDirs as $domainDir) {
    $destinationFile = $domainDir . 'public_html/update.php';
    
    // Salin file update.php
    if (copy($sourceFile, $destinationFile)) {
        echo "Berhasil menyalin update.php ke $destinationFile\n";
    } else {
        echo "Gagal menyalin update.php ke $destinationFile\n";
    }
}

More Posts