You are not logged in.
I managed to get all my music into a whole mess using Picard (music brainz) without really monitoring what it was doing.
I've ended up with music in folder paths such as /album/name/artist/name/artist/name/artist/name/artist/name/artist/name/artist/name/artist/songs
The exact wording of the path is not regular except for the repetition.
I need to somehow call a script that would look for repetition in path names, copy all the files to the top level and then remove the sub/sub/sub directories.
Not sure where to start....
Offline
... or you could just copy/move all the music files to another dir somewhere and use picard or another tagger in a sensible way to create a sane sub-dir structure.
Offline
Offline
I'll give you the hint anyway:
man find
Offline
......of course what I wanted was a nice line with
for this and that do this and that bla bla
resulting in the files all being moved, checks for any wierdness and then removal of the redundant dir structure.
What I had to do was a set of manual /*/* kind of mv commands until I thought I had all the music in one location.
Oh well. All done now
thanks for the tip on the find command. !(
Offline
I realize I'm late to the party, but you could have moved all your music files from your faulty directory structure to a new directory using the following bash script.
#!/bin/bash
shopt -s globstar
for f in **/*.{mp3,ogg,flac}
do
dest="${f%%/*}"
[[ -d "$dest" && -w "$dest" ]] && mv "$f" "$dest"
done
The 'shopt -s globstar' sets the "globstar" shell option. This causes the '**' in the next line to match 0 or more directories and subdirectories.
The way this script works is as follows. The script would loop, setting 'f' to the name of each music file in succession. Assume that for some iteration of the loop, f gets set to:
f -> "album1/name/artist/.../name/artist/song1.mp3"
then dest would get set to:
dest -> "album1"
and finally the command
mv "album1/name/artist/.../name/artist/song1.mp3" "album1"
would be executed. You would have to manually delete your empty subdirectories.
If you wanted to preserve the 'album/name/artist/' directory structure and simply remove the redundant 'name/artist/...' subdirectories, that could be done, but it would probably require a script that is much more complicated.
Offline