Skip to content

Instantly share code, notes, and snippets.

@mxrss
Created December 20, 2014 01:14
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 mxrss/a217a419cea6484f2d4d to your computer and use it in GitHub Desktop.
Save mxrss/a217a419cea6484f2d4d to your computer and use it in GitHub Desktop.
$count = $idx = 0
try {
"Splitting $from using $upperBound bytes per file."
do {
$count = $fromFile.Read($buff, 0, $buff.Length)
if ($count -gt 0) {
$to = "{0}{1}.{2}.{3}" -f ($fromFolder, $rootName, $idx, $ext)
$toFile = [io.file]::OpenWrite($to)
try {
"Writing to $to"
$tofile.Write($buff, 0, $count)
} finally {
$tofile.Close()
}
}
$idx ++
} while ($count -gt 0)
}
finally {
$fromFile.Close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment