Since Technet Gallery is closed, now here.
See Script Center version: Powershell functions to split and join binary files fast.
Now also on Powershell Gallery as part of the SysAdminsFriends module, see here or install with
Install-Module SysAdminsFriendsProject page on github is here.
Two Powershell functions to split and join binary files fast. The functions are using .Net BinaryWriter methods.
If .Net 4 or above is detected, the quick .CopyTo() method is used to join files.
2020-05-03: Split-File can chunk into parts of size > 2GB now
in the following examples I assume all files are in the current directory
Dot source the functions first:
. .\Split-File.ps1You can then split a file BigFile.dat with
Split-File "BigFile.dat" 10000000into parts of 10000000 byte size or to parts of the default size of 100 MB with
Split-File "BigFile.dat"The generated part files are named BigFile01.dat, BigFile02.dat, BigFile03.dat ...
You can join the part files BigFile01.dat, BigFile02.dat, BigFile03.dat ... to the original file e.g. with
dir BigFile??.dat | Join-File Rebuild.datRebuild.dat is the same file as the original BigFile.dat.