Flatten directory structure

Recently I brought a mp3 player that wasn’t able to shuffle the track through all folders. That’s why I had to bring all tracks to the root directory of the player (flatten directory structure). I did it with the following command, that flattens the whole structure by searching all files in the structure and copying them to the current folder (player root).

$> find . -mindepth 2 -type f -exec mv -t . -if '{}'

After that I could delete the empty folders and all tracks were shuffleable.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.