Created
January 8, 2013 05:35
-
-
Save anonymous/4481502 to your computer and use it in GitHub Desktop.
m3u to sync dir of hardlinks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
ROOTDIR=/media/storage/sounds | |
pushd "${ROOTDIR}" | |
grep -v '^#' music/Checked.m3u | sed -e 's./Volumes/storage/sounds/..' | \ | |
while read TRACK | |
do | |
if [ -e "${TRACK}" ] | |
then | |
DESTDIR=$(echo "${TRACK}" | sed -e "s/^music/sync/") | |
if [ ! -e "${DESTDIR}" ] | |
then | |
mkdir -p "${DESTDIR}" | |
fi | |
pushd "${DESTDIR}" > /dev/null | |
ln "${ROOTDIR}/${TRACK}" | |
popd > /dev/null | |
else | |
echo "could not find ${TRACK}" | |
fi | |
done | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment