diff --git a/Winget-AutoUpdate/mods/_AppID-template.ps1 b/Winget-AutoUpdate/mods/_AppID-template.ps1 index 07ac85b..e824b73 100644 --- a/Winget-AutoUpdate/mods/_AppID-template.ps1 +++ b/Winget-AutoUpdate/mods/_AppID-template.ps1 @@ -32,6 +32,13 @@ $DelValue = "" #Remove file/directory, multiple: "file1","file2" $DelFile = @("") +#Copy file/directory +#Example: +#$CopyFile = "C:\Logfiles" +#$CopyTo = "C:\Drawings\Logs" +$CopyFile = "" +$CopyTo = "" + <# FUNCTIONS #> . $PSScriptRoot\_Mods-Functions.ps1 @@ -57,5 +64,8 @@ if ($DelKey) { if ($DelFile) { Remove-ModsFile $DelFile } +if ($CopyFile -and $CopyTo) { + Copy-ModsFile $CopyFile $CopyTo +} <# EXTRAS #> diff --git a/Winget-AutoUpdate/mods/_Mods-Functions.ps1 b/Winget-AutoUpdate/mods/_Mods-Functions.ps1 index 4ccb78e..e57e53a 100644 --- a/Winget-AutoUpdate/mods/_Mods-Functions.ps1 +++ b/Winget-AutoUpdate/mods/_Mods-Functions.ps1 @@ -168,3 +168,11 @@ function Remove-ModsFile ($DelFile) { } Return } + +function Copy-ModsFile ($CopyFile, $CopyTo) { + if (Test-Path "$CopyFile") { + Copy-Item -Path $CopyFile -Destination $CopyTo -Recurse -Force -ErrorAction SilentlyContinue | Out-Null + } + Return +} +