I've enhanced it a little further to make it plug and play for my SQL script that finds duplicate albums:
#!/bin/bash
# bash script to find all .wv files in a given tree and return the full path including filename, the path excluding filename, the filename and the wavpack md5 of the audio stream
# Define the search directory (default to current directory if not provided)
SEARCH_DIR="${1:-.}"
# Find all .wv files and process them
find "$SEARCH_DIR" -type f -name "*.wv" | while read -r file; do
full_path="$(realpath "$file")"
dir_path="$(dirname "$full_path")"
file_name="$(basename "$full_path")"
echo -n "$full_path|$dir_path|$file_name|"
wvunpack -f7 "$file"
done
If you redirect the output of that script to a csv file using >> to append the file for every subtree you add, you can find duplicate albums by running the following code in Sqlite (obv. you need to create a database first):
CREATE TABLE alib (
__path TEXT,
__dirpath TEXT,
__filename TEXT,
__md5sig TEXT
);
Import the csv file into the table
DROP TABLE IF EXISTS __dirpath_content_concat__md5sig;
CREATE TABLE __dirpath_content_concat__md5sig (__dirpath TEXT, concat__md5sig TEXT);
INSERT INTO
__dirpath_content_concat__md5sig (__dirpath, concat__md5sig)
SELECT
__dirpath,
group_concat (__md5sig, " | ")
FROM
(
SELECT
__dirpath,
__md5sig
FROM
alib
ORDER BY
__dirpath,
__md5sig
)
GROUP BY
__dirpath;
DROP TABLE IF EXISTS __dirpaths_with_same_content;
CREATE TABLE __dirpaths_with_same_content (killdir TEXT, __dirpath TEXT, concat__md5sig TEXT);
INSERT INTO
__dirpaths_with_same_content (__dirpath, concat__md5sig)
SELECT
__dirpath,
concat__md5sig
FROM
__dirpath_content_concat__md5sig
WHERE
concat__md5sig IN (
SELECT
concat__md5sig
FROM
__dirpath_content_concat__md5sig
GROUP BY
concat__md5sig
HAVING
count(*) > 1
)
ORDER BY
concat__md5sig,
__dirpath;
DROP TABLE IF EXISTS __dirpaths_with_albums_to_kill;
CREATE TABLE __dirpaths_with_albums_to_kill (__dirpath TEXT, concat__md5sig TEXT);
INSERT INTO
__dirpaths_with_albums_to_kill (__dirpath, concat__md5sig)
SELECT
__dirpath,
concat__md5sig
FROM
__dirpaths_with_same_content
WHERE
rowid NOT IN (
SELECT
max(rowid)
FROM
__dirpaths_with_same_content
GROUP BY
concat__md5sig
);