-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathin.ps1
More file actions
43 lines (31 loc) · 1.06 KB
/
in.ps1
File metadata and controls
43 lines (31 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Change Me
###################################
# The file name to create from the byte chunk files
$OutputFile = "./test.zip"
# The path to the in folder where the byte chunk files will be read
$InFolderPath = "./in/"
# The file extension to the byte file chunks
$InFileExtension = ".txt"
###################################
If(!(test-path $InFolderPath))
{
New-Item -ItemType Directory -Force -Path $InFolderPath
}
$result = [System.IO.Directory]::GetFiles($InFolderPath, $InFileExtension)
Write-Host $result
$InFileCount = [System.IO.Directory]::GetFiles($InFolderPath).Count
if($InFileCount -eq 0)
{
Write-Host There were no byte files found inside $InFolderPath
exit
}
try {
$ostream = [System.Io.File]::OpenWrite($OutputFile)
for($i=0;$i -lt $InFileCount;$i++) {
$fileName = $InFolderPath + $i.toString() + ".txt"
$byteLines = [byte[]][System.IO.File]::ReadAllLines($fileName)
Write-Host Now writing the bytes of file number $i
$ostream.Write($byteLines, 0, $byteLines.Count)
}
}
finally { $ostream.close(); }