Skip to content

Instantly share code, notes, and snippets.

@scbedd
Created December 5, 2020 00:20
Show Gist options
  • Save scbedd/a611aaeb66cd46bc7814e308cb4fab6d to your computer and use it in GitHub Desktop.
Save scbedd/a611aaeb66cd46bc7814e308cb4fab6d to your computer and use it in GitHub Desktop.
Given a folder, find all readmes with a given suffix in them and supplant existing non-preview readmes with them
param(
$targetFolder,
$suffix="-pre.md"
)
Get-ChildItem -Path $targetFolder "*$suffix" | ForEach-Object {
Write-Host $_
$NewName = $_.Name.replace($suffix, ".md")
$Destination = Join-Path -Path $_.Directory.FullName -ChildPath $NewName
Move-Item -Path $_.FullName -Destination $Destination -Force
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment