@@ -85,21 +85,12 @@ $AutoRestTempFolder | ForEach-Object {
8585 Write-Debug " Removing cached file $File "
8686 if (Test-Path $File.FullName ) {
8787 # Remove the file
88- # Remove-Item -Path $File.FullName -Force -confirm:$false
88+ Remove-Item - Path $File.FullName - Force - confirm:$false
8989 }
9090 }
9191 }
9292}
9393
94- # Delete any file in temp folder with the extension .tmp or .log or .db
95- Get-ChildItem - Path $TempPath - Recurse | Where-Object { $_.Extension -match " .tmp|.log|.db" } | ForEach-Object {
96- $File = $_
97- Write-Debug " Removing cached file $File "
98- if (Test-Path $File.FullName ) {
99- # Remove the file
100- # Remove-Item -Path $File.FullName -Force -confirm:$false
101- }
102- }
10394$Stopwatch = [system.diagnostics.stopwatch ]::StartNew()
10495$CpuCount = (Get-CimInstance Win32_Processor).NumberOfLogicalProcessors
10596$Throttle = [math ]::Min(4 , $cpuCount / 2 ) # Use half the CPU count but max 4
@@ -144,22 +135,6 @@ $ModuleToGenerate | ForEach-Object -Parallel {
144135 if ($OpenFiles.Count -gt 0 ) {
145136 $OpenFiles = Get-OpenFiles - Path $TempPath
146137 }
147-
148- # Delete any file in temp folder with the extension .tmp or .log or .db
149- Get-ChildItem - Path $TempPath - Recurse | Where-Object { $_.Extension -match " .tmp|.log|.db|.db-shm|.db-wal" } | ForEach-Object {
150- $File = $_
151- Write-Debug " Removing cached file $File "
152- if (Test-Path $File.FullName ) {
153- # Remove the file
154- try {
155- # Remove-Item -Path $File.FullName -Force -confirm:$false
156- }
157- catch {
158- Write-Warning " Failed to remove file $File "
159- }
160- }
161- }
162-
163138
164139} - ThrottleLimit $Throttle
165140$stopwatch.Stop ()
0 commit comments