Modules/copy-binary.ps1
2024-01-31 10:05:28 +01:00

30 lines
888 B
PowerShell

param(
[String]$SourcePath,
[String]$FileName,
[String]$Configuration,
[String]$ProjectName
)
$ArchiveFolderName = "Archiv"
$DestinationPath = "P:\Install .Net\0 DD - Bibliotheken\Modules\$ProjectName\"
$DestinationFilePath = [IO.Path]::Combine($DestinationPath, $FileName)
$ArchiveBasePath = [IO.Path]::Combine($DestinationPath, $ArchiveFolderName)
if ($Configuration -eq "Release") {
$DateFolderName = $((Get-Date).ToString('yyyy-MM-dd_hh-mm'))
$ArchivePath = [IO.Path]::Combine($ArchiveBasePath, $DateFolderName)
if (!(Test-Path -Path $ArchiveBasePath)) {
New-Item -Path $ArchiveBasePath -Type Directory
}
if (Test-Path -Path $DestinationFilePath) {
if (!(Test-Path -Path $ArchivePath)) {
New-Item -Path $ArchivePath -Type Directory
}
Copy-Item $DestinationFilePath -Destination $ArchivePath
}
Copy-Item $SourcePath -Destination $DestinationFilePath
}