I have a Music directory, and an MP3 player with two SD card slots. The contents of the directory is too big for one card, so I'd like to split it over two.
I like to have stuff in alphabetical order. If I filled up SD1 and left SD2 partly empty, whenever I add new music I'd either have to break the alphabetical order by putting new stuff on SD2, or re-jig everything around.
The other thing is that my directories are grouped by Artist, so if I got a new album by an artist on SD1 it wouldn't fit.
In short, I want the two cards filled up roughly equally.
Right now my solution is actually OK:
- List the directories and output the list to a file
- Open the file and find the halfway point (I'm sure there's a clever way to do this but it's quick to do manually in vim)
- Cut the bottom half of the list and paste it to a second file
rsync --files-from=using one file on SD1 and the next on SD2. Job done!
This got me thinking though, is there a more accurate way to do this so that the two SD cards get filled more evenly? How would you go about this?
I guess I would have to maybe
duon the Music dir to find the
- Then loop through every Artist dir to get their sizes and keep a running total.
- Once that total surpasses the
totalSize * 0.5, output a list of all the dirs you just counted to get the first half and put the rest in a second file to get the other half?
- Do the same rsync from-file
Anyone got any better ideas?