What I have so far:
Get-ChildItem -Path "\\Networkdrive\Folder1\PROD- TEST\Successful" -Recurse |
Where-Object name -match '\w{10}_\w{3}' |
Move-Item -destination "\\Networkdrive\Folder1\Archive- TEST\Archive_PROD_TEST\Successful" -Verbose
Inside of : \\Networkdrive\Folder1\PROD- TEST\Successful
are folders that look like: 9ce8eab8-cefe-4ec9-9158-ff40612d5c47
and then in them are more folders that have criteria 10 numbers with an underscore (_
) and then followed by 3 numbers.
I want to move the 9ce8eab8-cefe-4ec9-9158-ff40612d5c47
folder if any subfolder contains the criteria of 10 characters followed by an _
and then and other 3 characters to \\Networkdrive\Folder1\Archive- TEST\Archive_PROD_TEST\Successful
, but I want to leave the Structure and files alone.
Right now the code just grabs the folders inside and then moves them, but leaves the 9ce8eab8-cefe-4ec9-9158-ff40612d5c47
folders alone. I want 9ce8eab8-cefe-4ec9-9158-ff40612d5c47
to be moved too.