This is not the first time I thought about it and it took a lot of digging and googling in order to get the right command line to do it. So, all credit goes to the thefekete.net who is the initial poster and my only contribution is turning the initial command line into a script.
#!/bin/bash
# ------------------------------------------------------------------------------------
# Copy all files from a playlist to a dest folder
# ------------------------------------------------------------------------------------
if [ "$#" != 2 ]; then
echo usage $0 playlist.m3u dest-dir
exit 1
fi
if [ ! -d "$2" ]; then
mkdir $2
echo Creating directory `pwd`"/"$2
fi
if [ -z "$1" ]; then
echo $1 is not a valid file
exit 2
fi
cat "$1" | grep -v '#' | while read i; do cp "${i}" "$2" ; echo "${i}"; done
Thank you the thefekete
No comments :
Post a Comment