Showing posts with label conversion. Show all posts
Showing posts with label conversion. Show all posts

Saturday, December 19, 2020

Bash Script for converting APE to FLAC

This is a little script I use for batch converting ape files in a folder into flac.

 

#!/bin/bash
for f in *.ape
do
    mac "$f"  "${f%.*ape}.wav" -d && flac --best "${f%.*ape}.wav" && rm "${f%.*ape}.wav"
done
 

Saturday, May 23, 2020

PowerShell Script for batch WAV/APE to FLAC

This is a script I use for converting any WAV/APE files in a folder to FLAC.

$files = Get-ChildItem -Recurse -path . -filter *.ape
foreach ($file in $files) {
    $path = Split-Path -Path $file.FullName
    $new_name = [IO.Path]::GetFileNameWithoutExtension($file) + ".wav"
  
    $new_name = Join-Path $path $new_name
  
    mac $file.FullName $new_name -d
}

$files = Get-ChildItem -Recurse -path . -filter *.wav
foreach ($file in $files) {
    flac --best $file.FullName
}

Monday, July 30, 2018

Convert multiple text files to UTF encoding

If you have multiple files and want to convert them all into UTF (without BOM), you can try this PowerShell script.

Get-ChildItem . -recurse -File -filter *.txt* | % {
        $MyFile = Get-Content -Raw $_.Fullname
        $MyPath = $_.Fullname
        [System.IO.File]::WriteAllLines($MyPath, $MyFile, [System.Text.UTF8Encoding]($False))
}
[System.IO.File]::WriteAllLines is used instead of the more commonly used Out-File because the latter outputs UTF8-BOM instead of plain UTF.