In case anyone needs this:
This was the solution:
$sourcePath = '\Networkdrive\Folder1\PROD- TEST\Successful'
$destination = '\Networkdrive\Folder1\Archive- TEST\Archive_PROD_TEST\Successful'
$folderPattern = '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'
$subdirPattern = '\d{10}\d{3}' # if the name must match FULLY, use anchors: '^\d{10}\d{3}$'
Get-ChildItem -Path $sourcePath -Directory | Where-Object {$.Name -match $folderPattern} | ForEach-Object {
# capture the folders FullName for when we hit the catch block in case of error
$targetFolder = $.FullName
if (@(Get-ChildItem -Path $targetFolder -Directory | Where-Object { $.Name -match $subdirPattern }).Count) {
# one or more subfolders found with name matching the $subdirPattern, so move the folder
Write-Host "Moving folder '$targetFolder'"
try {
Move-Item -Path $targetFolder -Destination $destination -Force -ErrorAction Stop
}
catch {
Write-Warning "Error moving folder '$targetFolder':r
n$($.Exception.Message)"
}
}
}