Jump to content
IGNORED

Renaming Recovered FLAC Files In A Large Batch From Hard Disk Crash On Mac OS


Recommended Posts

A (bash) script is perhaps the most appropriate solution.

I do not use Mac (Linux only) but bash syntax is the same.

In this case only renames flac files, not to directories. It can be modified to do so.

I recommend you try it in a directory created for this purpose (with a copy of some flac files in multiple directories) to see if it does what you expect.

The format is: track n° - title

 

You only need to install flac and metaflac if you did not. You can check this by opening a terminal and typing metaflac --help.

If the program is recognized skip to 2-

 

1- If the program is not recognized, you must install:

- with Homebrew

brew install flac

-Or downloading binary (eg Rarewares, not the latest version but anyway) and copying it to your PATH -as root or with sudo- eg:

mv flac metaflac /usr/local/bin
cd /usr/local/bin
chmod a+x metaflac flac

 

2- If you already have them installed, copy the following into an empty file:

#!/bin/bash

for i in *.flac
do

TITLE=`metaflac "$i" --show-tag=TITLE | sed s/.*=//g`
TRACKNUMBER=`metaflac "$i" --show-tag=TRACKNUMBER | sed s/.*=//g`
#ARTIST=`metaflac "$i" --show-tag=ARTIST | sed s/.*=//g`
#ALBUM=`metaflac "$i" --show-tag=ALBUM | sed s/.*=//g`

mv "$i" "$TRACKNUMBER - $TITLE.flac"
done

save it, name it as you like (for example renameflac), and move it to your PATH -as root o with sudo- (or you can create a symbolic link, especially if you want to change it later) eg:

mv renameflac /usr/local/bin
cd /usr/local/bin
chmod a+x renameflac

Close the Terminal.

Thus it became a "pseudo-program"

 

3- You have everything ready. Now navigate with the terminal to the directory where you have all the flac:

cd "path/to/directory with flac files/"

in your case I think

cd "/unix/Volumes/Old Files Recovered/"

*It may be more comfortable be placed in the directory with Finder and "Open a Terminal Here"

I think Mac does not have the "Open Terminal Here" function but can be added with ShellHere

In this terminal type:

 find -name "*.flac" -execdir renameflac {} \;

Remember that only renames files, not directories. This can be changed (I am not an expert of bash scripting, but I can try to help)

 

Sorry for my english.

[...] "Do fathers always know more than sons?" and the father said, "yes". The next question was, "Daddy, who invented the steam engine?" and the father said, "James Watt." And then the son came back with "- but why didn't James Watt's father invent it?"

Gregory Bateson

Steps to an Ecology of Mind (...)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...