I use my mac laptop strictly for Serato, and manage my library on my PC. This entails a constant copying process to keep the laptop updated with all the new bits coming in. I don’t know about anyone else but the Finder on the mac infuriates me. I just want to drag and drop the source folder and it copy all the missing files from all sub directories. Whatever the mac tries to do does not end up like this, and if it does it takes ages!!

Fortunately the mac exposes its file system at the prompt and will let you execute scripts on it quite happily, without your windows permissions bullshit intervening. This means you can run a script which will copy all your tunes (and other stuff) in seconds.. Much quicker and zero faff, so that’s what I did. Check it out:

#!/usr/bin/env zsh


folder=""
if [[ -n "${1:-}" ]]; then
	folder=$1
	echo "Copying $folder Directory"
fi

target="/Users/location/to/copy/to/"
source="/Volumes/location/to/copy/from/"
logdir="~/Documents/serato/logs"

if [[ ! -d "$source" ]]; then
	echo "Source not reachable!"
	exit 1
fi

if [[ ! -d "$target$folder" ]]; then
	echo "Cannot find $folder on $target!"
	exit 1
elif [ "$folder" != "" ]; then
	target="$target$folder/"
fi


if [[ ! -d "$source$folder" ]]; then
	echo "Cannot find $folder on $source!"
	exit 1
elif [ "$folder" != "" ]; then
	source="$source$folder/"
fi

echo "Source: ${source}"
echo "Target: ${target}"
echo "Starting Run" > "$logdir/progress.txt"
find "$target" -type f -name "*.mp3" > "$logdir/target_${folder}tunes.txt"
find "$source" -type f -name "*.mp3" > "$logdir/new_${folder}Tunes.txt"

read -p "That is the plan, continue: (y/n)" choice
if [ $choice = "y" ]; then
	cp -R -n -v "${source}" "${target}" >> "$logdir/progress.txt"
else
	echo "Maybe another time..."
	exit 1
fi

results=$(grep -F ".mp3" "$logdir/progress.txt" | grep -F " -> " | wc -l)
unchanged=$(grep "not overwritten" "$logdir/progress.txt" | wc -l)

echo "$results tunes added!"
echo "$unchanged other tunes... " 

There it is, if you want to leverage you’d need to update the source and target folders, target is where the tunes should be copied to, and source is where they are copied from. I left /Volumes in there, as you’ll probs want to connect to an external drive too. You’ll need to copy that somewhere you can access, consider adding the folder to the PATH, google will help you out with that. Then fire off the script once you’re ready to copy your library across. If you only want to copy one sub directory within source across fire the script with the Directory name as the argument e.g.

sh copyTunes.sh "Hip Hop"

My copy differs slightly, I do an rsync after the copy to put any files which have been updated (cue points added, tags updated etc) back on the source, so next time I wipe it locally I don’t lose all my loop setups and queue points from within the tunes. I also pipe all output through lolcat, you know me! Hmmm I’ve just had an idea!

If you try it out, drop a comment below with how much time it saved you.

Leave a Reply

Privacy & more..

Cookie Consent Policy