Copy file/directory in Mod Template/Functions
parent
72bcf77672
commit
237e9c3106
|
@ -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 #>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue