I have a powershell script with three sections: 1. modify file names to remove MicrosoftOS reserved characters; 2. run /usr/bin/flac to convert *.wav files to *.flac, 3. use .dll to copy ID3 tags from *.mp3 files to *.flac files.
All three sections of this script worked on my previous Kubuntu v22.10 system. This script fails at step 2 on MXLinux v21. The error is "File not found" for the objects of the /usr/bin/flac command. /usr/bin/flac loads, but says that it cannot find the file given to it. Steps 1 and 3 work (I know this because the script takes an argument to skip step 2; thus I can run it if the *.wav files are already *.flac files, e.g., on a previous run where step 2 was successful but step 3 failed for some reason).
Here is the PS code fragment:
[string] $flacEXE = '/usr/bin/flac'
if($convert -eq "yes" || $convert -eq "Yes" || $convert -eq "YES")
{
if (Test-Path -Path "$workingPath/*cr.wav")
{
$CRFiles = Get-ChildItem -Path "$workingPath/*cr.wav"
foreach ($crFile in $CRFiles)
{
$output = & $flacEXE "`"$crFile`""
if ($LASTEXITCODE -ne 0)
{
Write-Host "The flac conversion created an error..." -ForegroundColor Red
Write-Host "$output" -ForegroundColor Red
}
}
}
else
{
Write-Host "No ClickRepair files found but Convert was Yes ... Aborting script.`n" -ForegroundColor Red
throw $_.Exception.Message
exit
}
}
If I run /usr/bin/flac from the prompt in powershell (e.g., in Visual Studio Code), it fails. If I run /usr/bin/flac from a linux terminal on the same files in the same folder, it works.
I think this must be some sort of permissions issue (scope issue?), but cannot figure it out. The files are on a NTFS USB volume mounted on /mnt/. I recently migrated to MXLinux and thus have recreated my system. This is my first use of this powershell script.
I should note that the concert of Set-ExecutionPolicy is not valid for Powershell Core on Linux, only on Windows systems, so that's not useful.