diff --git a/music-sync.sh b/music-sync.sh index 2ba2a45..7773fe7 100755 --- a/music-sync.sh +++ b/music-sync.sh @@ -167,7 +167,8 @@ CreateFileList() { # ${2} /mnt/mtp/Example-Artist/Example-Album # ${3} Example-Artist/Example-Album IFS="" - sourcepath="${1}/*" + sourcepath="${1/\[/\\\[}/*" + sourcepath="${sourcepath/\]/\\\]}" for file in $sourcepath; do relfile="${file#"$1/"}" if [[ -d "${1}/$relfile" ]]; then @@ -187,6 +188,7 @@ ConvertFiles() { percentage=0 while read -r line do + if [[ ! -f "${source}/$line" ]]; then VerboseOutput 5 "Source-file ${source}/$line Unreachable" ExecTime @@ -218,13 +220,13 @@ CopyFiles() { percentage=0 while read -r line do - if [[ ! -f "$dest" ]]; then + if [[ ! -d "$dest" ]]; then VerboseOutput 5 "Destination unreachable" ExecTime exit 4 fi - if [[ ! -f "$line" ]]; then + if [[ ! -f "${temp}/$line" ]]; then VerboseOutput 5 "Source-file ${temp}/$line Unreachable" ExecTime exit 3 @@ -234,6 +236,7 @@ CopyFiles() { total=$(cat /tmp/music-sync-filelist | wc -l) percentage=$(echo "scale=4;${curline}/${total}" | bc) percentage=$(echo "scale=2;${percentage}*100" | bc) + VerboseOutput 1 "Copying: $line" VerboseOutput 2 "Progress: $curline / $total (${percentage%00}%) Step 2 of 2"