Пример #1
0
function lxfile_cp_rec($dirsource, $dirdest)
{
    dprint("<b> I am here </b> ");
    $obj = new COM("Scripting.FilesystemObject");
    $username = "******";
    $dirdest = expand_real_root($dirdest);
    $dirsource = expand_real_root($dirsource);
    if (lfile_exists($dirdest) && is_dir($dirdest)) {
        $dirdest = $dirdest . "/" . basename($dirsource);
    }
    if (is_dir($dirsource)) {
        log_filesys("copyFolder {$dirsource} {$dirdest}");
        $obj->CopyFolder($dirsource, $dirdest);
    } else {
        log_filesys("copyFile {$dirsource} {$dirdest}");
        $obj->CopyFile($dirsource, $dirdest);
    }
}
Пример #2
0
/**
 * Copy the album art file to local directory with ASCII only characters so PHP can work with it properly
 * COM object must be used for unicode filenames
 *
 * @param string $file Absolute path of art file
 * @return bool True/false success/failure
 */
function copyArt(string $file) : bool
{
    $destination = getcwd() . "\\art\\" . basename($file);
    $return = false;
    echo "Copying album art...";
    try {
        $com = new COM("Scripting.FileSystemObject", null, CP_UTF8);
        $com->CopyFile($file, $destination);
        $return = true;
    } catch (Exception $e) {
        echo "Unable to copy art '{$file}' to '{$destination}': " . $e->getMessage() . "\n";
    }
    $com = null;
    return $return;
}