internal/functions/Copy-CFXData.ps1

function Copy-CFXData {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string] $SourcePath,

        [Parameter(Mandatory = $true)]
        [string] $DestinationPath,

        [Parameter(Mandatory = $true)]
        [string] $DataLabel
    )


    #Prepare Folders

    #Copy Files
    try {
        $roboCopyError = $null

        $robocopyDestination = (Join-PSFPath $mountPoint.Path 'Profile')
        $robocopyLogPath = Join-PSFPath $env:Temp "$(Split-Path -Path $DestinationPath -Leaf).robocopy.log"


        $robocopyLogPath = Join-PSFPath $env:Temp "$(Split-Path -Path $DestinationPath -Leaf).robocopy.$DataLabel.log"
        Copy-CFXRobocopy -Source $SourcePath -Destination $robocopyDestination -LogPath $robocopyLogPath -ErrorAction Stop

    }
    catch {
        $roboCopyError = $_

        throw $roboCopyError
    }

    #


    Dismount-CFXProfile -DiskPath $DiskPath -Cookie $mountPoint.Cookie -FRX $FRX
}