Copy-SSPFiles.ps1

<#
    .Synopsis
    Copies a source site folder to the destination.
    .Description
    This CmdLet gets a SiteTemplate from the source and instantiates it at the
    destination url. It attempts to download image files from the source in
    the Site Assets folder and upload them to the destination site.
    .Parameter SrcConnection
    This parameter contains the connection context for the source site. The default is the current connection
    returned by "Get-PnPConnection".
    .Parameter DestConnection
    This parameter contains the connection context for the destination site. The default is the current connection
    returned by "Get-PnPConnection".
 #>

#>

function Copy-SSPFiles {
    param(
        $srcFolder,
        $destFolder,
        $matches = @("*"),
        $srcConnection = (Get-PnPConnection),
        $destConnection = (Get-PnPConnection)
    )

    $drname = New-TemporaryFile | %{ rm $_; mkdir $_ ; $_ }
    $files = Get-SSPFiles -Folder $srcFolder -Path $drname.FullName -Matches $matches -Connection $srcConnection
    Add-SSPFiles -Files $files -Folder $destFolder -Path $drname.FullName -Connection $destConnection
}