-
Notifications
You must be signed in to change notification settings - Fork 0
/
move-radiotracks.ps1
48 lines (40 loc) · 1.29 KB
/
move-radiotracks.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
[CmdletBinding()]
param(
$station="diamondcity",
$filter=$null,
$sourceFolder=".\MultiXwm\output",
$falloutFolder="C:\Program Files (x86)\Steam\steamapps\common\Fallout 4"
)
Write-Verbose "STATION: $station"
Write-Verbose "SOURCE: $sourceFolder"
Write-Verbose "FALLOUT: $falloutFolder"
$falloutRadioFolder = Join-Path $falloutFolder (Join-Path "sound\fx\mus\radio" $station)
Write-Verbose "DEST: $falloutRadioFolder"
if (!(Test-Path $sourceFolder))
{
write-error "$sourceFolder not found."
}
$stationFile = "radio-stations\$station.txt"
if (!(Test-Path $stationFile))
{
write-error "$station not found in .\radio-stations."
}
if(!(Test-Path $falloutRadioFolder))
{
New-Item -Path $falloutRadioFolder -ItemType Directory -Force
}
Write-Verbose "Reading from $stationFile"
$files = Get-Content $stationFile
foreach ($file in $files)
{
if ($filter -and $file -match $filter) { continue }
Write-Verbose "Writing $file"
$nextFileName = (gci $sourceFolder -File | select -First 1).FullName
if (!$nextFileName -or !(Test-Path $nextFileName))
{
Write-Error "Cannot find source files, specify a different -sourceFolder: '$sourceFolder'"
exit
}
$destFile = Join-Path $falloutRadioFolder $file
Move-Item $nextFileName -Destination $destFile
}