-
Finding & Copying Only The New Music Files
Given a collection of music files in various subdirectories, find all the
mp3files that aren’t in the target directory and copy them. The only catch: don’t usersync, because the target directory is on a Google Pixel phone filesystem which doesn’t support various attributes required byrsync.The solution goes like this:
cd /mnt/music/Netlabel Mixes sudo jmtpfs /mnt/pixel -o allow_other,fsname="Pixel" find . -name \*mp3 -execdir test ! -e /mnt/pixel/Internal\ shared\ storage/Music/Netlabel/\{\} \; -execdir cp -v -t /mnt/pixel/Internal\ shared\ storage/Music/Netlabel/ \{\} \; sudo umount /mnt/pixelThe trick is remembering the second
execdiroperation infindhappens only if the first succeeds, so thecpruns when the target file doesn’t exist.All the backslash escaping gets tedious, but it’s the least awful way to get the job done when the directories contain blanks, which is true for the default directory structure inside the Pixel.
Your choice in music will surely be different …