Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Usage
- if [ $# -ne 1 ]
- then
- echo Usage : pls2dir FILE
- exit
- fi
- # Make directory
- dir=${1/.pls/}
- if [ ! -d "$dir" ]
- then
- echo -n "Make directory : "
- echo $dir
- mkdir "$dir"
- else
- echo "Directory already exist"
- fi
- # File for list of musics with some filters
- out=$(mktemp)
- grep File "$1" | cut -d"=" -f2 | sed 's/file:\/\///' > $out
- out2=$(mktemp)
- # Copy each music to the directory
- while read line
- do
- printf "%b\n" "${line//%/\\x}"
- done < $out > $out2
- while read line
- do
- cp "$line" "$dir"
- done < $out2
- #### Semplification ####
- #
- # You can rid of the temp files by combining the commands like this:
- #
- #
- # while read line; do
- # file=$( printf "%b\n" "${line//%/\\x}" );
- # cp "$file" "$dir";
- # done < <( grep File "$1" | cut -d"=" -f2 | sed 's/file:\/\///' )
- #
- # NOT TESTED :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement