Via PowerShell, I would like to edit the page layout of all the publishing pages that live within a specific folder (or any subfolders of that folder) in the Pages library. I found this script that gets me most of the way there but I have no clue how filter based on folder.
$SPAssignment = Start-SPAssignment
$spWeb = Get-SPWeb("http://currentsitename/webname")
$spFile = $spWeb.GetFile("http://currentsitename/webname/Pages/Test-Page.aspx")
$spFile.CheckOut("Online",$null)
$spFile.Properties["PublishingPageLayout"] = "/_catalogs/masterpage/Block.aspx, Block"
$spFile.Update()
$spFile.CheckIn("Update page layout via PowerShell", [Microsoft.SharePoint.SPCheckinType]::MajorCheckIn)
Stop-SPAssignment $SPAssignment
This only has to be run one time, I'm not opposed to using a console application instead.