You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
476 B

#!/bin/bash
# Find all .flac files that are directly inside an Artist/ folder (depth = 2)
find . -mindepth 2 -maxdepth 2 -type f -iname "*.flac" | while read -r file; do
dir_path="$(dirname "$file")"
base_name="$(basename "$file" .flac)"
new_folder="$dir_path/$base_name"
new_path="$new_folder/$(basename "$file")"
# Create a new folder and move the file
echo "Moving: $file$new_path"
mkdir -p "$new_folder"
mv "$file" "$new_path"
done