Skip to content

Instantly share code, notes, and snippets.

@pr3sidentspence
Created December 3, 2018 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pr3sidentspence/a17848af1b59b5e7042d432e8e05eef8 to your computer and use it in GitHub Desktop.
Save pr3sidentspence/a17848af1b59b5e7042d432e8e05eef8 to your computer and use it in GitHub Desktop.
Script simply renames files as named by postcardscansimple.exe to an almalgamated version of it's BermanID.
Param(
[Parameter(Mandatory=$true)][string]$binder = $null
)
write-host renner started
Get-ChildItem -Filter *.bmp |
Foreach-Object {
# $origName = $_.FullName -replace 'f', '-front'
if ($_.BaseName -match '^[0-9]*[f|b]$') {
if ($_.BaseName -match 'f') {
$side = 'front'
}
else {
$side = 'back'
}
$origNum = [int]($_.BaseName -replace '[f|b]', '')
# Write-Host $origNum
$bottomID = (3 * $origNum).ToString("000")
$middleID = (3 * $origNum - 1).ToString("000")
$topID = (3 * $origNum - 2).ToString("000")
#$binder = $_.DirectoryName -replace '^.*\\(.*)$', '$1'
Write-Host Renaming $_.FullName to B$binder-$topID-$middleID-$bottomID-$side.bmp
& Rename-Item $_.FullName B$binder-$topID-$middleID-$bottomID-$side.bmp
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment