Skip to content

Instantly share code, notes, and snippets.

@SilvortheGrand
Created February 15, 2025 22:14
Show Gist options
  • Save SilvortheGrand/4edc446e239e9d6a3d9b09ae06824e99 to your computer and use it in GitHub Desktop.
Save SilvortheGrand/4edc446e239e9d6a3d9b09ae06824e99 to your computer and use it in GitHub Desktop.
A simple PowerShell script to bulk copy audio files that can be used as audio replacers
if (-not (Test-Path "./ids.txt")) {
Write-Host "The 'ids.txt' has not yet been created. It will be created now. Please copy-paste all the ids you'd like to have audio for into it."
"" | Out-File ./ids.txt
Read-Host "Once you are done, press ENTER"
}
[string[]] $audioFiles = (Get-ChildItem *.wav).FullName
[string[]] $ids = (Get-Content -Path ./ids.txt -Raw).Split([Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries)
if (!(Test-Path -path "./audioreplacements/")) {
Write-Host "Creating export folder..."
New-Item "./audioreplacements/" -Type Directory | Out-Null
}
Write-Host "Beginning copying procedure..."
for ([int] $index = 0; $index -lt $ids.Count; $index++) {
$audioFile = $audioFiles[$index % $audioFiles.Count]
$id = $ids[$index]
Write-Host "Using '$audioFile' to create '/audioreplacements/$id.wav'..."
Copy-Item $audioFile -Destination "./audioreplacements/$id.wav"
}
Read-Host "Procedure complete. Please review the console log for any errors, then press ENTER."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment