You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Set the path to the folder where the script is located$scriptPath= (Get-Item-Path $MyInvocation.MyCommand.Path).Directory.FullName
# Set the path for the new 'm4a' folder$m4aFolderPath=Join-Path-Path $scriptPath-ChildPath 'm4a'# Create the 'm4a' folder if it doesn't existif (-not (Test-Path-Path $m4aFolderPath-PathType Container)) {
New-Item-Path $m4aFolderPath-ItemType Directory |Out-Null
}
# Get all the FLAC files in the current folder$flacFiles=Get-ChildItem-Path $scriptPath-Filter *.flac
# Loop through each FLAC file and convert it to ALACforeach ($flacFilein$flacFiles) {
$ogFileName=$flacFile.BaseName$newFileName="$($ogFileName).m4a"# Run ffmpeg command& ffmpeg -i "$($flacFile.FullName)"-c:v copy -c:a alac "$($newFileName)"# Move the converted file to the 'm4a' folderMove-Item-Path $newFileName-Destination $m4aFolderPath
}
Write-Host"Conversion and move completed."
Bash
#!/bin/bash# Set the path to the folder where the script is located
scriptPath=$(dirname "$(readlink -f "$0")")# Set the path for the new 'm4a' folder
m4aFolderPath="$scriptPath/m4a"# Create the 'm4a' folder if it doesn't existif [ !-d"$m4aFolderPath" ];then
mkdir "$m4aFolderPath"fi# Get all the FLAC files in the current folder
flacFiles=("$scriptPath"/*.flac)
# Loop through each FLAC file and convert it to ALACforflacFilein"${flacFiles[@]}";do
ogFileName=$(basename "$flacFile" .flac)
newFileName="${ogFileName}.m4a"# Run ffmpeg command
ffmpeg -i "$flacFile" -c:v copy -c:a alac "$newFileName"# Move the converted file to the 'm4a' folder
mv "$newFileName""$m4aFolderPath/"doneecho"Conversion and move completed."