mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 18:42:35 -05:00
Delete temporary files from previous runs
This commit is contained in:
@ -146,6 +146,19 @@ function Invoke-WPFGetIso {
|
|||||||
$sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\'
|
$sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Detect if the folders already exist and remove them
|
||||||
|
if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text))
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Write-Host "Deleting temporary files from previous run. Please wait..."
|
||||||
|
Remove-Item -Path $sync.MicrowinMountDir.Text -Recurse -Force
|
||||||
|
Remove-Item -Path $sync.MicrowinScratchDir.Text -Recurse -Force
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host "Could not delete temporary files. You need to delete those manually."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "Setting up mount dir and scratch dirs"
|
Write-Host "Setting up mount dir and scratch dirs"
|
||||||
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
|
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
|
||||||
|
17
winutil.ps1
17
winutil.ps1
@ -10,7 +10,7 @@
|
|||||||
Author : Chris Titus @christitustech
|
Author : Chris Titus @christitustech
|
||||||
Runspace Author: @DeveloperDurp
|
Runspace Author: @DeveloperDurp
|
||||||
GitHub : https://github.com/ChrisTitusTech
|
GitHub : https://github.com/ChrisTitusTech
|
||||||
Version : 24.03.29
|
Version : 24.03.30
|
||||||
#>
|
#>
|
||||||
param (
|
param (
|
||||||
[switch]$Debug,
|
[switch]$Debug,
|
||||||
@ -47,7 +47,7 @@ Add-Type -AssemblyName System.Windows.Forms
|
|||||||
# Variable to sync between runspaces
|
# Variable to sync between runspaces
|
||||||
$sync = [Hashtable]::Synchronized(@{})
|
$sync = [Hashtable]::Synchronized(@{})
|
||||||
$sync.PSScriptRoot = $PSScriptRoot
|
$sync.PSScriptRoot = $PSScriptRoot
|
||||||
$sync.version = "24.03.29"
|
$sync.version = "24.03.30"
|
||||||
$sync.configs = @{}
|
$sync.configs = @{}
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
|
||||||
@ -3303,6 +3303,19 @@ function Invoke-WPFGetIso {
|
|||||||
$sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\'
|
$sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Detect if the folders already exist and remove them
|
||||||
|
if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text))
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Write-Host "Deleting temporary files from previous run. Please wait..."
|
||||||
|
Remove-Item -Path $sync.MicrowinMountDir.Text -Recurse -Force
|
||||||
|
Remove-Item -Path $sync.MicrowinScratchDir.Text -Recurse -Force
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host "Could not delete temporary files. You need to delete those manually."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "Setting up mount dir and scratch dirs"
|
Write-Host "Setting up mount dir and scratch dirs"
|
||||||
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
|
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
|
||||||
|
Reference in New Issue
Block a user