#!/bin/bash MPDBASE="/hdd/hudba/" MPDPLAYLISTSDIR='/var/lib/mpd/playlists/' NUMBER=0 TARGET="/hdd/data_1/converted/" PLAYL="$1" if [ -z "$PLAYL" ]; then ls -1 $MPDPLAYLISTSDIR exit 0 fi if [ -e "$MPDPLAYLISTSDIR$PLAYL" ]; then mkdir "$TARGET/$PLAYL" cat "$MPDPLAYLISTSDIR$PLAYL" | while read line; do echo "got line: $MPDBASE$line" ((NUMBER++)) if [ $NUMBER -lt 10 ]; then NEWNAME="0"$NUMBER else NEWNAME=$NUMBER fi cp "$MPDBASE$line" "$TARGET/$PLAYL/$NEWNAME - `echo ${line#*/}`" done fi