My brother insists that I write a blog post about this, even though it’s really just basic Unix stuff and not anything the least bit esoteric, or even related to Syncthing really.
I didn’t want to sync my entire music library to my phone, because it’s huge, and about half of it is just stuff that was either of merely passing interest, or really no interest at all. So, I decided to create a folder I called “Core music,” that would contain the other half of my music library—all the stuff I might actually want to listen to. However, I didn’t want to make copies of 7 GB of music files, because that would be crazy.
My first thought was just to create a folder with symbolic links to the music I wanted to sync to my server (and thence to my phone). But that didn’t work at all. (That is, Syncthing just syncs the symbolic links, and since the music wasn’t on my server, on the server they didn’t point to anything.)
My second thought was to make hard links, but even though I’m a Unix nerd from way back, I initially started by trying to make hard links to the folders that had the music I cared about, because it has been years since I did this sort of thing. Of course that didn’t work at all. (You can’t hard link to a directory, for reasons.)
Finally, I created this little function:
function linkmusic { pax -rwl '$1' ~/Music/Core\ music; }
Then I could invoke it by cd
ing into my iTunes Music folder (where the directories actually are) and then invoking the function for each folder I wanted in my “Core music” folder. (My natural inclination is to go to the folder where I want the music to end up, but then the pax command didn’t do what I wanted, because it wanted to copy the whole directory structure, but I just wanted to copy the directory structure starting at iTunes Music, so that’s where I wanted to be when I invoked my function.)
So, let’s hope that Steven is happy now that I’ve documented this.