Last active
September 28, 2023 02:32
-
-
Save Hashbrown777/a34e68cc5189438828dfe734e3efc43d to your computer and use it in GitHub Desktop.
Resizes files anchoring to EOF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'3705688449 ,setup_cyberpunk_2077_build_4902785change_6408866_with_ep1_rl_(64bit)_(67718)-25.bin | |
2124976 ,setup_cyberpunk_2077_build_4902785change_6408866_with_ep1_rl_(64bit)_(67718).exe | |
30669496 ,setup_cyberpunk_2077_redmod_build_4902785change_6408866_with_ep1_rl_(64bit)_(67718).exe' -split '\n' ` | |
| %{ | |
$expected,$name = $_ -split ',' | |
$expected = [UInt32]$expected | |
$diff = (gci $name).Length - $expected | |
if (!$diff) { | |
return | |
} | |
$bs = 1 | |
while (!($diff -band 1)) { | |
$bs *= 2 | |
$diff /= 2 | |
} | |
dd ` | |
"if=$name" ` | |
"of=${name}_" ` | |
"bs=$bs" ` | |
"$(('seek','skip')[!($diff -lt 0)])=$([Math]::Abs($diff))" | |
gci $name | Rename-Item -NewName "_$name" | |
gci "${name}_" | Rename-Item -NewName $name | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment