forked from timmcmic/DLConversionV2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemove-statusFiles.ps1
More file actions
91 lines (66 loc) · 2.71 KB
/
Remove-statusFiles.ps1
File metadata and controls
91 lines (66 loc) · 2.71 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<#
.SYNOPSIS
This function removes all status files in the status file directory.
.DESCRIPTION
This function removes all status files in the status file directory.
.PARAMETER functionThreadNumber
The thread number of the status file to remove.
.PARAMETER fullCleanup
Determines if all status files should be removed.
.OUTPUTS
Empty status file directory.
.EXAMPLE
remove-statusFiles -functionThreadNumber 1
#>
Function remove-statusFiles
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory = $false)]
[int]$functionThreadNumber=0,
[Parameter(Mandatory = $false)]
[boolean]$fullCleanup=$FALSE
)
#Output all parameters bound or unbound and their associated values.
write-functionParameters -keyArray $MyInvocation.MyCommand.Parameters.Keys -parameterArray $PSBoundParameters -variableArray (Get-Variable -Scope Local -ErrorAction Ignore)
[array]$threadStatus="ThreadZeroStatus.txt","ThreadOneStatus.txt","ThreadTwoStatus.txt","ThreadThreeStatus.txt","ThreadFourStatus.txt","ThreadFiveStatus.txt","ThreadSixStatus.txt","ThreadSevenStatus.txt","ThreadEightStatus.txt","ThreadNineStatus.txt","ThreadTenStatus.txt"
[string]$functionPath=$NULL
if ($fullCleanUp -eq $FALSE)
{
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN remove-StatusFile"
Out-LogFile -string "********************************************************************************"
$functionPath=Join-path $global:fullStatusPath $threadStatus[$functionThreadNumber]
out-logfile -string $functionPath
}
else
{
$functionPath=$global:fullStatusPath+"*"
}
try
{
if ($fullCleanup -eq $FALSE)
{
out-logfile -string "Removing files from the status directory."
}
remove-item -path $functionPath -force -errorAction STOP
}
catch
{
if ($fullCleanup -eq $FALSE)
{
out-logfile -string "Error removing log files." -isError:$TRUE
}
else
{
$_
}
}
if ($fullCleanup -eq $FALSE)
{
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "END remove-StatusFile"
Out-LogFile -string "********************************************************************************"
}
}