Removing final dots in dest

This commit is contained in:
Jeroen De Meerleer 2019-07-01 12:34:43 +02:00
parent 72d8a2dcff
commit 99a2ab4784

View File

@ -250,14 +250,14 @@ CreateFileList() {
VerboseOutput 0 "Checking ${origfile}"
if [[ -d "${1}/$origfile" ]]; then
VerboseOutput 0 "${origfile} is folder"
newdir="${3}/$relfile"
newdir="${3}/$origfile"
newdir=${newdir#"/"}
VerboseOutput 1 "Entering $newdir"
CreateFileList "${1}/$origfile" "${2}/$relfile" "$newdir"
elif [[ "${1}/$origfile" != *".m3u" ]] && [[ ! -f "${2}/$relfile" || "${1}/$origfile" -nt "${2}/$relfile" ]]; then
echo ${3}/$relfile >> /tmp/music-sync-filelist
elif [[ "${1}/$origfile" != *".m3u" ]] && [[ ! -f "${2}/$origfile" || "${1}/$origfile" -nt "${2}/$relfile" ]]; then
echo ${3}/$origfile >> /tmp/music-sync-filelist
VerboseOutput 0 "${origfile} is newer in source"
VerboseOutput 1 "Added: ${3}/${origfile}"
VerboseOutput 2 "Added: ${3}/${origfile}"
fi
if [[ "${1}/$origfile" == *".m3u" ]]; then
VerboseOutput 0 "${origfile} is playlist"
@ -334,16 +334,16 @@ CopyFiles() {
total=$(cat /tmp/music-sync-filelist | wc -l)
percentage=$(echo "scale=4;${curline}/${total}" | bc)
percentage=$(echo "scale=2;${percentage}*100" | bc)
destline=$(echo $line | sed -e 's/\.*\//\//g')
VerboseOutput 1 "Copying: $line"
VerboseOutput 2 "Progress: $curline / $total (${percentage%00}%) Step 2 of 2"
if [[ "$dest/$line" = */* ]]; then
VerboseOutput 0 "Creating folder $dest/${line%/*}"
mkdir -p "$dest/${line%/*}";
mkdir -p "$dest/${destline%/*}";
fi;
cp -f $temp/$line $dest/$line 1>/dev/null 2>/dev/null
cp -f $temp/$line $dest/$destline 1>/dev/null 2>/dev/null
VerboseOutput 2 "Copied: $line"