-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShow-SplitFiles.ps1
More file actions
55 lines (46 loc) · 1.63 KB
/
Show-SplitFiles.ps1
File metadata and controls
55 lines (46 loc) · 1.63 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<#
.SYNOPSIS
Show all the large file parts that have been split
.DESCRIPTION
This script checks the size of files in the source directory and throws an error if any file exceeds the specified threshold size.
The threshold size is set to 50MB by default, but can be changed by modifying the $threshold variable.
.PARAMETER threshold
The maximum file size allowed in bytes. Default is 50MB (52428800 bytes).
.EXAMPLE
.\Verify-SourceFileSizes.ps1 -threshold 100MB
This command will check for files larger than 100MB in the source directory.
.NOTES
Author: Martin Smith
Date: 2024-01-04
#>
param (
[int32]$threshold = 50MB
)
. $PSScriptRoot\Include-Scripts.ps1
$items = Get-ChildItem -Path $PSScriptRoot -Recurse -Filter "*.z01" -File
Write-Host "Found $($items.count) candidate files"
$index = 0
if ($items.Count -gt 0) {
foreach($item in $items) {
++$index
$parts = Get-ChildItem -Path $item.Directory -Filter "$($item.BaseName)*" -File | Sort-Object Name
Write-SeparatorLine
Write-Host "${index}: File: $($item.BaseName) [$($parts.Count) parts]" -ForegroundColor Yellow
$partIndex = 0
foreach ($part in $parts) {
++$partIndex
Write-Host "${index}.${partIndex}: $($part.FullName) - $($part.Length)"
}
}
}
exit 0
if ($index -gt 0) {
Write-SeparatorLine
Write-Host "Failure" -ForegroundColor Red -NoNewline
Write-Host " - ${index}" -ForegroundColor Yellow -NoNewline
Write-Host " Invalid files found"
}
else {
Write-Host "Success" -ForegroundColor Green -NoNewline
Write-Host " - No Invalid files found"
}