18 lines
882 B
PowerShell
18 lines
882 B
PowerShell
|
$tempFolder = "C:\Users\dmitr\Documents\Repos\local\fvtt-shared-compendia\temp"
|
||
|
$dbFolder = "C:\Users\dmitr\Documents\Repos\local\fvtt-shared-compendia\src\packs"
|
||
|
|
||
|
$archiveList = Invoke-RestMethod -Method Get https://nexus.kdiva.ru/service/rest/v1/search?repository=generic
|
||
|
$archiveUrl = $archiveList.items.assets | Sort-Object -Property lastModified | Select-Object -ExpandProperty downloadUrl -Last 1
|
||
|
$archiveName = [System.IO.Path]::GetFileName($archiveUrl)
|
||
|
|
||
|
if (!(Test-Path -Path $tempFolder)){
|
||
|
New-Item -Path $tempFolder -ItemType Directory -Force
|
||
|
}
|
||
|
|
||
|
Invoke-RestMethod -Method Get -Uri $archiveUrl -OutFile $tempFolder\$archiveName
|
||
|
|
||
|
Expand-Archive -Force -Path $tempFolder\$archiveName -DestinationPath $tempFolder
|
||
|
|
||
|
Get-ChildItem -Path $tempFolder -Filter "*.db" | foreach $_ {Move-Item -Force -Path $_ -Destination $dbFolder}
|
||
|
|
||
|
Remove-Item -Force -Recurse -Path $tempFolder
|